Package nu.xom

Examples of nu.xom.DocType


   
    public void testDocTypeIsNotAnXPathNode() {
    
        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
       
        Nodes result = doc.query("child::node()[1]");
        assertEquals(1, result.size());
        assertEquals(root, result.get(0));
View Full Code Here


    public void testGetNodeBeforeDocType() {
    
        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
        Comment c = new Comment("test");
        doc.insertChild(c, 0);
       
        Nodes result = doc.query("child::node()[1]");
View Full Code Here

    public void testCantUseDocTypeAsXPathContextNode() {
    
        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
       
        try {
            doctype.query("/");
            fail("Allowed DocType as context node");
        }
        catch (XPathException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

   
    public void testToDocumentWithDocType() {
    
        Nodes input = new Nodes();
        Element root = new Element("root");
        DocType doctype = new DocType("root");
        Comment comment = new Comment("data");
        ProcessingInstruction pi = new ProcessingInstruction("target", "data");
        input.append(comment);
        input.append(doctype);
        input.append(root);
View Full Code Here

   
    public void testToDocumentWithDocTypeInEpilog() {
    
        Nodes input = new Nodes();
        Element root = new Element("root");
        DocType doctype = new DocType("root");
        Comment comment = new Comment("data");
        ProcessingInstruction pi = new ProcessingInstruction("target", "data");
        input.append(comment);
        input.append(root);
        input.append(doctype);
View Full Code Here

   
   
    public void testDocType() 
      throws IOException, SAXException, ParsingException {
        Document doc = new Document(new Element("a"));
        doc.setDocType(new DocType("root"));
        convertAndCompare(doc);
    }
View Full Code Here

       
        for (int i = 0; i < illegalChars.length; i++) {
            String utf16 = convertToUTF16(illegalChars[i]);
            String url = "http://www.example.com/" + utf16 + ".xml";
            try {
                new DocType("root", url);
                fail("Allowed URL containing 0x" +
                  Integer.toHexString(illegalChars[i]).toUpperCase());
            }
            catch (MalformedURIException success) {
                assertNotNull(success.getMessage());
View Full Code Here

        };
       
        for (int i = 0; i < addresses.length; i++) {
            String url = "http://[" + addresses[i] + "]/";
            try {
                new DocType("root", url);
                fail("Allowed illegal IPv6 address: " +  addresses[i] );
            }
            catch (MalformedURIException success) {
                assertNotNull(success.getMessage());
                assertTrue(success.getData().indexOf(addresses[i]) >= 0);
View Full Code Here

                    process(f);
                }
                else {
                    try {
                        Document doc = builder.build(f);
                        DocType doctype = new DocType("html",
                          "-//W3C//DTD XHTML 1.0 Frameset//EN",
                          "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-frameset.dtd");
                        doc.setDocType(doctype);
                        Attribute en = new Attribute("lang", "en-US");
                        Attribute xmlen = new Attribute("xml:lang",
View Full Code Here

    private DocType doctypeSystemID;
    private DocType doctypeRootOnly;

   
    protected void setUp() {
        doctypePublicID = new DocType(name, publicID, systemID);
        doctypeSystemID = new DocType(name, systemID);
        doctypeRootOnly = new DocType(name);
        System.setErr(new PrintStream(new ByteArrayOutputStream()));
    }
View Full Code Here

TOP

Related Classes of nu.xom.DocType

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.