Package nu.xom

Examples of nu.xom.Serializer


            return;
        }       
       
        try {
            Builder builder = new Builder((NodeFactory) Class.forName(args[0]).newInstance());
            Serializer outputter = new Serializer(System.out, "ISO-8859-1");
            Document input = builder.build(args[1]);
            outputter.write(input);
        }
        catch (ClassNotFoundException ex) {
            System.err.println("Could not find filter " + args[0]);
        }
        catch (Exception ex) {
View Full Code Here


                        Element body = root.getFirstChildElement("body", "http://www.w3.org/1999/xhtml");
                        Element frameset = root.getFirstChildElement("frameset", "http://www.w3.org/1999/xhtml");
                        if (frameset != null && body != null) {
                            root.removeChild(body);
                        }
                        Serializer serializer = new HTMLSerializer(new FileOutputStream(f));
                        serializer.write(doc);
                        serializer.flush();
                    }
                    catch (ParsingException ex) {
                        ex.printStackTrace();
                    }
                    catch (IOException ex) {
View Full Code Here

       
        Builder builder = new Builder();
        byte[] data = null;
        ByteArrayOutputStream out = new ByteArrayOutputStream(100000);   
        // Write data into a byte array using encoding
        Serializer serializer = new Serializer(out, encoding);
        serializer.write(doc);
        serializer.flush();
        out.flush();
        out.close();
        data = out.toByteArray();
        InputStream in = new ByteArrayInputStream(data);
        Document reparsed = builder.build(in);
View Full Code Here

        InputStream in = new ByteArrayInputStream(data);
        Document doc = builder.build(in);
       
        // make a Unicode normalized version of the same document
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        Serializer serializer = new Serializer(out);
        serializer.setUnicodeNormalizationFormC(true);
        serializer.write(doc);
        byte[] temp = out.toByteArray();
        in = new ByteArrayInputStream(temp);
        Document nfcDoc = builder.build(in);
       
        assertEquals("Parser doesn't use NFC when converting from " + encoding,
View Full Code Here

        InputStream in = new ByteArrayInputStream(data);
        Document doc = builder.build(in);
       
        // make a Unicode normalized version of the same document
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        Serializer serializer = new Serializer(out);
        serializer.setUnicodeNormalizationFormC(true);
        serializer.write(doc);
        temp = out.toByteArray();
        in = new ByteArrayInputStream(temp);
        Document nfcDoc = builder.build(in);
       
        // String normalizedResult = Normalizer.normalize(rawResult, Normalizer.NFC);
View Full Code Here

        params.appendChild(param);
        param.appendChild(value);
        value.appendChild(data);
        Document doc = new Document(methodCall);

        Serializer serializer = new Serializer(out, "US-ASCII");
        serializer.write(doc);
         
        InputStream in = connection.getInputStream();
         
        Builder parser = new Builder();
        Document response = parser.build(in);
View Full Code Here

         lineItem.appendChild(field);
       }
       budget.appendChild(lineItem);
    }

    Serializer serializer = new Serializer(out, "UTF-8");
    serializer.write(doc);
    serializer.flush();
       
  }
View Full Code Here

        }
       
        try {
          Builder parser = new Builder();
          Document doc = parser.build(args[0]);
          Serializer serializer = new Serializer(System.out, "ISO-8859-1");
          serializer.setIndent(4);
          serializer.setMaxLength(64);
          serializer.setPreserveBaseURI(true);
          serializer.write(doc);
          serializer.flush();
        }
        catch (ParsingException ex) {
          System.out.println(args[0] + " is not well-formed.");
          System.out.println(ex.getMessage());
        }
View Full Code Here

        File debug = new File("data");
        debug = new File(debug, "xinclude");
        debug = new File(debug, "debug");
        File output = new File(debug, name);
        FileOutputStream out = new FileOutputStream(output);
        Serializer serializer = new Serializer(out);
        serializer.write(result);       
       
    }
View Full Code Here

      */
    public static void main(String[] args) {
 
        Builder builder = new Builder();
        try {
            Serializer outputter = new Serializer(System.out, "ISO-8859-1");
            Document input = builder.build(args[0]);
            XIncluder.resolveInPlace(input);
            outputter.write(input);
        }
        catch (Exception ex) {
            System.err.println(ex);
            ex.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of nu.xom.Serializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.