Package nu.xom

Examples of nu.xom.Serializer


        serializer.flush();
    }

    private static void serialize(Document document, OutputStream out)
        throws UnsupportedEncodingException, IOException {
        Serializer serializer = new Serializer(out, "UTF-8");
        serializer.write(document);
        serializer.flush();
    }
View Full Code Here


     *     encounters an I/O error
     * @throws NullPointerException if <code>doc</code> is null
     */
    public static void write(Document doc, OutputStream out)
      throws IOException {
        Serializer serializer = new Serializer(out);
        serializer.write(doc);
        serializer.flush();
    }
View Full Code Here

     * @throws NullPointerException if <code>doc</code> is null
     */
    public static void write(Document doc, OutputStream out, String encoding,
      int indent, int maxLength)
      throws IOException {
        Serializer serializer = new Serializer(out, encoding);
        serializer.setIndent(indent);
        serializer.setMaxLength(maxLength);
        serializer.write(doc);
        serializer.flush();
    }
View Full Code Here

    root.appendChild(child4);
    child4.addAttribute(new Attribute("xml:base",
      "http://www.w3.org/XML/1998/namespace", base3));
   
    try {
        Serializer serializer
          = new Serializer(System.out, "ISO-8859-1");
        serializer.setPreserveBaseURI(true);
        serializer.write(doc);
        serializer.flush();
        serializer.setPreserveBaseURI(false);
        serializer.write(doc);
        serializer.flush();
    }
    catch (IOException ex) {
        // shouldn't happen on System.out
        ex.printStackTrace();
    }
View Full Code Here

            DocType type = doc.getDocType();
            if (type != null) {
                doc.removeChild(type);  
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Serializer serializer = new Serializer(out);
            serializer.write(doc);
            serializer.flush();
            out.close();
            byte[] data = out.toByteArray();
            
            warmup(parser, iterator, data, 5);
            InputStream raw = new BufferedInputStream(
View Full Code Here

        }
       
        try {
          Builder parser = new Builder();
          Document doc = parser.build(args[0]);
          Serializer serializer = new SourceCodeSerializer(System.out, "ISO-8859-1");
          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

          }
          Document doc = new Document(root);
        try {
            OutputStream out = new FileOutputStream("fibonacci.xml");
            out = new BufferedOutputStream(out);
            Serializer serializer
             = new Serializer(out, "ISO-8859-1");
            serializer.write(doc);
       
        catch (IOException ex) {
            System.err.println("This shouldn't happen for Latin-1!");
        }
View Full Code Here

          root.appendChild("" + NEL);
          Document doc = new Document(root);
        try {
            OutputStream out
              = new FileOutputStream("fibonacci_ebcdic.txt");
            Serializer serializer
             = new Serializer(out, "Cp037");
            serializer.write(doc);
            serializer.flush();
       
        catch (IOException ex) {
            System.err.println(ex);
        }
View Full Code Here

            high = high.add(low);
            low = temp;
          }
          Document doc = new Document(root);
        try {
            Serializer serializer
             = new Serializer(System.out, "ISO-8859-1");
            serializer.write(doc);
       
        catch (IOException ex) {
            System.err.println("This shouldn't happen for Latin-1!");
        }
View Full Code Here

    try {     
      Element budget = new Element("Budget");
      writeAgencies(budget);
     
      Document doc = new Document(budget);
      Serializer sout = new Serializer(System.out, "UTF-8");
      sout.write(doc);
      sout.flush();
    }
    catch (IOException ex) {
      System.err.println(ex);
    }
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.