Package nu.xom

Examples of nu.xom.Comment


        Element root = new Element("test");         
        xomDocument = new Document(root);
        xomDocument.insertChild(type, 0);
        xomDocument.insertChild(new ProcessingInstruction(
         "xml-stylesheet", "href=\"file.css\" type=\"text/css\""), 1);
        xomDocument.insertChild(new Comment(" test "), 2);
        xomDocument.appendChild(new Comment("epilog"));
        root.addNamespaceDeclaration("xlink",
          "http://www.w3.org/TR/1999/xlink");
        root.appendChild("Hello dear\r\n");
        Element em = new Element("em");
        root.appendChild(em);
View Full Code Here


        byte[] data = "<element><!--data--></element>".getBytes();
        org.w3c.dom.Document doc = builder.parse(new ByteArrayInputStream(data));
         
        org.w3c.dom.Element root = doc.getDocumentElement();
        org.w3c.dom.Comment comment = (org.w3c.dom.Comment) (root.getChildNodes().item(0));
        Comment xomComment = DOMConverter.convert(comment);
        assertEquals(comment.getNodeValue(), xomComment.getValue());
                
    }
View Full Code Here

        Element first = (Element) result.get(0);
        assertEquals("name", first.getQualifiedName());
        assertEquals("name", first.getAttribute("name").getQualifiedName());
        assertEquals("value", first.getAttribute("name").getValue());
       
        Comment second = (Comment) result.get(1);
        assertEquals("data", second.getValue());
       
        Text third = (Text) result.get(2);
        assertEquals("text", third.getValue());
       
    }
View Full Code Here

        org.w3c.dom.Comment after = domDocument.createComment("after");
        domDocument.appendChild(after);
        domDocument.insertBefore(before, domDocument.getFirstChild());
        Document xomDocOut = DOMConverter.convert(domDocument, new ANodeFactory());
        assertTrue(xomDocOut instanceof ADocument);
        Comment bc = (Comment) xomDocOut.getChild(0);
        Comment ac = (Comment) xomDocOut.getChild(xomDocOut.getChildCount()-1);
        assertTrue(bc instanceof AComment);
        assertTrue(ac instanceof AComment);
       
    }
View Full Code Here

        Nodes output = xform.transform(input);
        assertEquals(6, output.size());
        assertEquals(element1, output.get(0));
        assertEquals(element2, output.get(1));
        assertEquals(new Element("element4"), output.get(3));
        assertEquals(new Comment("test"), output.get(4));
        assertEquals(new ProcessingInstruction("test",
          "PIs are not treated as literals in XSLT?"), output.get(5));
       
    }
View Full Code Here

        Nodes output = xform.transform(input);
        assertEquals(5, output.size());
        assertEquals(element1, output.get(0));
        assertEquals(element2, output.get(1));
        assertEquals(new Element("element4"), output.get(3));
        assertEquals(new Comment("test"), output.get(4));
       
    }   
View Full Code Here

        Nodes output = xform.transform(input);
        assertEquals(1, output.size());
        assertEquals("", output.get(0).getValue());
        Element root = (Element) output.get(0);
        assertEquals(1, root.getChildCount());
        Comment child = (Comment) root.getChild(0);
        assertEquals("test", child.getValue());
       
    }
View Full Code Here

   
   
    public void testToDocumentWithNoRoot() {
    
        Nodes input = new Nodes();
        input.append(new Comment("data"));
        try {
            XSLTransform.toDocument(new Nodes());
            fail("Converted comment to document");
        }
        catch (XMLException success) {
View Full Code Here

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

   
    public void testToDocumentWithAttribute() {
    
        Nodes input = new Nodes();
        Element root = new Element("root");
        Comment comment = new Comment("data");
        ProcessingInstruction pi = new ProcessingInstruction("target", "data");
        input.append(comment);
        input.append(root);
        input.append(pi);
        input.append(new Attribute("name", "text"));
View Full Code Here

TOP

Related Classes of nu.xom.Comment

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.