Package nu.xom

Examples of nu.xom.Document.toXML()


      throws ParsingException, IOException {
       
        Document doc = builder.build(new File(inputDir, "!file.xml"));
        String expectedResult = "<?xml version=\"1.0\"?>\n"
            + "<data />\n";
        String actual = doc.toXML();
        assertEquals(expectedResult, actual);
        assertTrue(doc.getBaseURI().startsWith("file:/"));
        assertTrue(doc.getBaseURI().endsWith("data/!file.xml"));
       
    }
View Full Code Here


        File f = makeFile("\"file\".xml");
        try {
            Document doc = builder.build(f);
            f.delete();
            String expectedResult = "<?xml version=\"1.0\"?>\n<data />\n";
            String actual = doc.toXML();
            assertEquals(expectedResult, actual);
            assertTrue(doc.getBaseURI().startsWith("file:/"));
            assertTrue(doc.getBaseURI().endsWith("data/%22file%22.xml"));
        }
        catch (FileNotFoundException ex) {
View Full Code Here

        File f = makeFile("'file'.xml");
        Document doc = builder.build(f);
        f.delete();
        String expectedResult = "<?xml version=\"1.0\"?>\n"
            + "<data />\n";
        String actual = doc.toXML();
        assertEquals(expectedResult, actual);
        assertTrue(doc.getBaseURI().startsWith("file:/"));
        assertTrue(doc.getBaseURI().endsWith("data/'file'.xml"));
       
    }
View Full Code Here

      throws ParsingException, IOException {
       
        Document doc = builder.build(new File(inputDir, "()file.xml"));
        String expectedResult = "<?xml version=\"1.0\"?>\n"
            + "<data />\n";
        String actual = doc.toXML();
        assertEquals(expectedResult, actual);
        assertTrue(doc.getBaseURI().startsWith("file:/"));
        assertTrue(doc.getBaseURI().endsWith("data/()file.xml"));
       
    }
View Full Code Here

      throws ParsingException, IOException {
       
        Document doc = builder.build(new File(inputDir, "{file}.xml"));
        String expectedResult = "<?xml version=\"1.0\"?>\n"
            + "<data />\n";
        String actual = doc.toXML();
        assertEquals(expectedResult, actual);
        assertTrue(doc.getBaseURI().startsWith("file:/"));
        assertTrue(doc.getBaseURI().endsWith("data/%"
          + Integer.toHexString('{').toUpperCase() + "file%"
          + Integer.toHexString('}').toUpperCase() + ".xml"));
View Full Code Here

       
        Builder builder = new Builder();
        File f = new File("data");
        f = new File(f, "xtest.xml");  
        Document input = builder.build(f);
        String s = input.toXML();
        Document output = builder.build(s, f.toURL().toExternalForm());
        assertEquals(input, output);
       
    }   
}
View Full Code Here

       
        Builder builder = new Builder();
        File f = new File("data");
        f = new File(f, "test.xml");  
        Document input = builder.build(f);
        String s = input.toXML();
        Document output = builder.build(s, f.toURL().toExternalForm());
        assertEquals(input, output);
       
    }
View Full Code Here

    public static void main(String[] args) {
  
        Element root = new Element("root", "http://www.xom.nu");   
        root.appendChild(new Element("NoNamespace"));
        Document doc = new Document(root);
        System.out.println(doc.toXML());
   
    }

}
View Full Code Here

  public static void main(String[] args) {
  
    Element root = new Element("root");   
    root.appendChild("Hello World!");
    Document doc = new Document(root);
    String result = doc.toXML();
    System.out.println(result);
   
  }

}
View Full Code Here

     
      // Modify the document
      ROT13XML.encode(document);

      // Write it out again
      System.out.println(document.toXML());

    }
    catch (IOException ex) {
      System.out.println(
      "Due to an IOException, the parser could not encode " + url
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.