Package nu.xom

Examples of nu.xom.Builder


            );
            return;
        }
     
        StreamingTypeCounter counter = new StreamingTypeCounter();
        Builder builder = new Builder(counter);
    
        try {
            builder.build(args[0]);
            counter.printCount();
        }
        // indicates a well-formedness error
        catch (ParsingException ex) {
            System.out.println(args[0] + " is not well-formed.");
View Full Code Here


    if (args.length == 0) {
      System.out.println("Usage: java nu.xom.samples.XHTMLQualifier URL");
      return;
    }
     
    Builder builder = new Builder();
    
    try {
      Document doc = builder.build(args[0]);
      Element root = doc.getRootElement();
      qualify(root);
      System.out.println(doc.toXML());    
    }
    // indicates a well-formedness error
View Full Code Here

          );
          return;
        }
       
        try {
          Builder parser = new Builder(new StreamingCommentReader());
          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

      System.out.println("Usage: java nu.xom.samples.XOMChecker URL");
      return;
    }
   
    try {
      Builder parser = new Builder();
      parser.build(args[0]);
      System.out.println(args[0] + " is well-formed.");
    }
    catch (ParsingException ex) {
      System.out.println(args[0] + " is not well-formed.");
      System.out.println(ex.getMessage());
View Full Code Here

          System.out.println("Usage: java nu.xom.samples.XMLPrinter URL");
          return;
        }
       
        try {
          Builder parser = new Builder();
          Document doc = parser.build(args[0]);
          System.out.println(doc.toXML());
        }
        catch (ParsingException ex) {
          System.out.println(args[0] + " is not well-formed.");
          System.out.println(ex.getMessage());
View Full Code Here

        }
        String url = args[0];
   
        try {
            // Find a parser
            Builder parser = new Builder();
     
            // Read the document
            Document document = parser.build(url);
    
            // Modify the document
            Restructurer.processNode(document.getRootElement());
     
            // Write it out again
View Full Code Here

 
  // Load a parser, transformer, and implementation
  public void init() throws ServletException
 
    try {
      this.parser = new Builder();
    }
    catch (Exception ex) {
      throw new ServletException(
       "Could not locate a JAXP parser", ex);
    }
View Full Code Here

   
    // This test will only pass if Java's NEL handling is fixed
    public void testEBCDIC037()
      throws ParsingException, UnsupportedEncodingException {
       
        Builder builder = new Builder();
        ByteArrayOutputStream out = new ByteArrayOutputStream();   
        try {
            // Write data into a byte array using encoding
            Serializer serializer = new Serializer(out, "Cp037");
            serializer.write(doc);
            serializer.flush();
            out.flush();
            out.close();
            byte[] result = out.toByteArray();

            // We have to look directly rather than converting to
            // a String because Java gets the conversion of NEL to
            // Unicode wrong
            for (int i = 0; i < result.length; i++) {
                if (result[i] == 0x15) fail("Bad NEL output");       
            }

            InputStream in = new ByteArrayInputStream(result);
            Document reparsed = builder.build(in);
            assertEquals(doc, reparsed);
        }
        catch (UnsupportedEncodingException ex) {
            throw ex;  
       
View Full Code Here

    protected void setUp() throws IOException {
        PipedReader pin = new PipedReader();
        out = new PipedWriter(pin);
        in = new BufferedReader(pin);
        actualResult = 0;
        builder =  new Builder(new MinimizingFactory());
        generator = new Generator();
        generator.start();
    }
View Full Code Here

    }
   
   
    public void testFranceschet1() throws ParsingException, IOException {
    
        Builder builder = new Builder();
        Document doc = builder.build(
          "http://staff.science.uva.nl/~francesc/xpathmark/benchmark_canon.xml"
        );
        Element root = doc.getRootElement();
        Elements inputs = root.getChildElements("document");
        Element input = inputs.get(0).getFirstChildElement("site");
View Full Code Here

TOP

Related Classes of nu.xom.Builder

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.