Examples of insertChild()


Examples of nu.xom.Document.insertChild()

        Comment c1 = new Comment("c1");
        Comment c2 = new Comment("c2");
        Comment c3 = new Comment("c3");
        Comment c4 = new Comment("c4");
       
        doc.insertChild(c1, 0);
        grandparent.insertChild(c2, 0);
        parent.insertChild(c3, 0);
        child.insertChild(c4, 0);
       
        Nodes result = doc.query("descendant::comment()[.='c3']");
View Full Code Here

Examples of nu.xom.Document.insertChild()

        ProcessingInstruction p1 = new ProcessingInstruction("c1", "1");
        ProcessingInstruction p2 = new ProcessingInstruction("c1", "2");
        ProcessingInstruction p3 = new ProcessingInstruction("c1", "3");
        ProcessingInstruction p4 = new ProcessingInstruction("c1", "4");
       
        doc.insertChild(p1, 0);
        grandparent.insertChild(p2, 0);
        parent.insertChild(p3, 0);
        child.insertChild(p4, 0);
       
        Nodes result = doc.query("descendant::processing-instruction()[.='3']");
View Full Code Here

Examples of nu.xom.Document.insertChild()

        Comment c1 = new Comment("c1");
        Comment c2 = new Comment("c2");
        Comment c3 = new Comment("c3");
        Comment c4 = new Comment("c4");
       
        doc.insertChild(c1, 0);
        grandparent.insertChild(c2, 0);
        parent.insertChild(c3, 0);
        child.insertChild(c4, 0);
        ProcessingInstruction pi = new ProcessingInstruction("appendix", "text");
        doc.appendChild(pi);
View Full Code Here

Examples of nu.xom.Document.insertChild()

            Node node = input.getChild(0);
            if (node instanceof Element) break;
            else {
                node.detach();
                if (node instanceof Text) continue;
                html.insertChild(node, p++);
            }
        }   
        Node newroot = input.getChild(0);
        newroot.detach();
        html.setRootElement((Element) newroot);
View Full Code Here

Examples of nu.xom.Document.insertChild()

        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]");
        assertEquals(1, result.size());
        assertEquals(c, result.get(0));
       
View Full Code Here

Examples of nu.xom.Document.insertChild()

   
    public void testProcessingInstruction()
      throws IOException, SAXException, ParsingException {
       
        Document doc = new Document(new Element("a"));
        doc.insertChild(new ProcessingInstruction(
          "xml-stylesheet", "type=\"application/xml\" href=\"stylesheet.xsl\""), 0)
        convertAndCompare(doc);
       
    }
   
View Full Code Here

Examples of nu.xom.Document.insertChild()

      throws IOException, SAXException, ParsingException {
       
        Element root = new Element("root");
        root.appendChild("   Lots of random text\n\n\n  ");
        Document doc = new Document(root);
        doc.insertChild(new Comment("some comment data"), 0)
        root.insertChild(new Comment("some comment data"), 0)
        doc.appendChild(new Comment("some comment data"))
        convertAndCompare(doc);
       
    }
View Full Code Here

Examples of nu.xom.Document.insertChild()

   
    public void testInsertionAllowed() {
       
        Document doc = new Document(new Element("root"));
        Comment original = new Comment("original");
        doc.insertChild(original, 0);
       
        Element temp = new Element("temp");
        Comment c2 = new Comment("new comment");
        temp.appendChild(c2);
       
View Full Code Here

Examples of nu.xom.Document.insertChild()

        catch (IllegalAddException success) {
            assertNotNull(success.getMessage());
        }
       
        try {
            doc.insertChild(new Element("test"), 0);
            fail("inserted element");
        }  
        catch (IllegalAddException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

Examples of nu.xom.Document.insertChild()

       
        // prolog
        for (int position = 0;
             current.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE;
             position++, current = current.getNextSibling()) {
            xomDocument.insertChild(convert(current), position);
        }
        // root element      
        current = current.getNextSibling();
       
        // epilog
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.