Package nu.xom

Examples of nu.xom.Builder.build()


    }
     
    Builder builder = new Builder();
    
    try {
      Document doc = builder.build(args[0]);
      Element root = doc.getRootElement();
      listChildren(root);     
    }
    // indicates a well-formedness error
    catch (ParsingException ex) {
View Full Code Here


        Builder parser = new Builder();
        try {
            // Separate out the basic I/O by parsing document,
            // and then serializing into a byte array. This caches
            // the document and removes any dependence on the DTD.
            Document document = parser.build(args[0]);

            long prewalk = System.currentTimeMillis();        
            // Process it starting at the root
            iterator.copy(document);
            long postwalk = System.currentTimeMillis();
View Full Code Here

    }
     
    Builder builder = new Builder();
    
    try {
      Document doc = builder.build(args[0]);
      Element root = doc.getRootElement();
      listChildren(root, 0);     
    }
    // indicates a well-formedness error
    catch (ParsingException ex) {
View Full Code Here

        Builder parser = new Builder();
        try {
            // Separate out the basic I/O by parsing document,
            // and then serializing into a byte array. This caches
            // the document and removes any dependence on the DTD.
            Document document = parser.build(args[0]);

            long prewalk = System.currentTimeMillis();        
            // Process it starting at the root
            iterator.copy(document);
            long postwalk = System.currentTimeMillis();
View Full Code Here

        long memory = r.totalMemory() - r.freeMemory();
       
        System.out.println("Initial: " + memory);
       
        Builder builder = new Builder();
        Document dataDoc = builder.build(elementData, "http://www.example.com");
        Element root = new Element("root");
        Document doc = new Document(root);
        Element dataElement = dataDoc.getRootElement();

       
View Full Code Here

        Builder parser = new Builder();
        try {   
            // Separate out the basic I/O by parsing document,
            // and then serializing into a byte array.
            // This caches the and removes any dependence on the DTD.
            Document doc = parser.build(args[0]);
            DocType type = doc.getDocType();
            if (type != null) {
                doc.removeChild(type);  
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

            System.gc(); System.gc(); System.gc();
           
            long prebuild = System.currentTimeMillis();
         
            // Read the entire document into memory
            Document document = parser.build(raw);
            long postbuild = System.currentTimeMillis();
           
            System.out.println((postbuild - prebuild)
              + "ms to build the document");
View Full Code Here

   
   
    public static void main(String[] args) throws Exception {
               
        Builder builder = new Builder();
        Document dataDoc = builder.build(elementData, "http://www.example.com");
        Element root = new Element("root");
        Document doc = new Document(root);
        Element dataElement = dataDoc.getRootElement();
       
        long pre = System.currentTimeMillis();
View Full Code Here

          return;
        }
       
        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) {
View Full Code Here

          return;
        }
       
        try {
          Builder parser = new Builder(new StreamingTextExtractor());
          parser.build(args[0]);
        }
        catch (ParsingException ex) {
          System.out.println(args[0] + " is not well-formed.");
          System.out.println(ex.getMessage());
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.