Package nu.xom

Examples of nu.xom.Builder.build()


          try {
            Builder builder = new Builder();
            int i = 0;
            while (i < files.length) {
              System.out.println("t="+ t + ", index="+i);
              Document doc = builder.build(files[i]);
              Object key = files[i];
              pool.putDocument(key, doc);
              i++;
            }
            System.out.println("done");
View Full Code Here


      if (input == null && baseURI == null)
        throw new IllegalArgumentException("input and baseURI must not both be null");
     
      Builder builder = newBuilder();
      if (baseURI == null)
        return builder.build(input);
      else
        return builder.build(input, baseURI.toASCIIString());     
    }
    finally { // better safe than sorry
      if (input != null) input.close();
View Full Code Here

     
      Builder builder = newBuilder();
      if (baseURI == null)
        return builder.build(input);
      else
        return builder.build(input, baseURI.toASCIIString());     
    }
    finally { // better safe than sorry
      if (input != null) input.close();
    }
  }
View Full Code Here

              new Builder(validate.equals("validate"))
          }
          checksum += builder.hashCode();
          if (! fileName.equals("nofile")) {
            Document doc = memory ?
                builder.build(new ByteArrayInputStream(bytes, 0, bytes.length)) :
                builder.build(new FileInputStream(fileName));
            //String str = doc.toXML();
            //System.out.print('.');
            checksum += doc.getChildCount();
          }       
View Full Code Here

          }
          checksum += builder.hashCode();
          if (! fileName.equals("nofile")) {
            Document doc = memory ?
                builder.build(new ByteArrayInputStream(bytes, 0, bytes.length)) :
                builder.build(new FileInputStream(fileName));
            //String str = doc.toXML();
            //System.out.print('.');
            checksum += doc.getChildCount();
          }       
        }
View Full Code Here

          if (file.getAbsolutePath().indexOf("-II-") >= 0) continue; // ignore invalid files
         
          System.out.println("\n" + k + ": now processing " + file + " ...");
          for (int p=0; p < 1; p++) {
            Document doc1 = getW3CBuilder().build(file);           
            Document doc2 = pooledBuilder.build(file);
           
            IOTestUtil.xomAssertEquals(doc1, doc2);
            IOTestUtil.canonicalAssertEquals(doc1, doc2);
          }
        }
View Full Code Here

                Document doc2 = null;
                if (cmd.equals("deser") || cmd.equals("serdeser") || cmd.equals("test")) {
                  if (mode.startsWith("bnux")) {
                    doc2 = codec.deserialize(new ByteArrayInputStream(data), bnuxFactory);
                  } else if (mode.startsWith("xom") && mode.indexOf("stax") >= 0) {
                    doc2 = staxBuilder.build(new ByteArrayInputStream(fileData));         
                  } else if (mode.startsWith("xom")) {
                    if (mode.indexOf("stream") < 0) {
                      doc2 = builder.build(new ByteArrayInputStream(fileData), baseURI);
                    } else {
                      doc2 = builder.build(new ByteArrayInputStream(data), baseURI);
View Full Code Here

        Builder builder = BuilderPool.GLOBAL_POOL.getBuilder(false);
        for (int i = 0; i < files.length; i++) {
          if (!files[i].isDirectory()) {
            Document doc;
            try {
              doc = builder.build(files[i]);
            } catch (Exception e) {
              throw new TransformerException(e);
            }
           
            sources.add(wrap(doc, docWrappers));
View Full Code Here

             + "  <servlet-name>DeviceInfoServlet</servlet-name>\n"
             + "  <url-pattern>/tools/*</url-pattern>\n"
             + "</servlet-mapping>\n</root>";
        
         Builder builder = new Builder();
         Document doc = builder.build(data, null);
        
         Nodes result = doc.query("//*[./../servlet-name = 'DeviceInfoServlet']");
         assertEquals(2, result.size());
      
     }        
View Full Code Here

       
        // TODO point this, at least optionally, at the jaxen directory in the zip file instead.
        // However, first you'll have to push a jaxen 1.2.1 that fixes tests.xml.
        String base = "http://svn.jaxen.codehaus.org/browse/~raw,r=trunk/jaxen/trunk/jaxen/";
        Builder builder = new Builder();
        Document testDoc = builder.build(base + "xml/test/tests.xml");
        Elements documents = testDoc.getRootElement().getChildElements("document");
        for (int i = 0; i < documents.size(); i++) {
            Element documentElement = documents.get(i);
            String url = documentElement.getAttributeValue("url");
            Document source = builder.build(
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.