Package nu.xom

Examples of nu.xom.Element.insertChild()


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


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

        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);
        ProcessingInstruction pi2 = new ProcessingInstruction("test", "text");
        parent.appendChild(pi2);
       
View Full Code Here

        String name = "red:sakjdhjhd";
        String uri = "http://www.red.com/";
        Element e = new Element(name, uri);
        String data = null;
        try {
            e.insertChild(data, 0);
            fail("Inserted null");
        }
        catch (NullPointerException success) {
            // success;  
        }
View Full Code Here


    public void testInsertString() {
       
        Element element = new Element("test");
        element.insertChild("test", 0);

        String s = null;
        try {
            element.insertChild(s, 0);
            fail("Inserted string as null");
View Full Code Here

        Element element = new Element("test");
        element.insertChild("test", 0);

        String s = null;
        try {
            element.insertChild(s, 0);
            fail("Inserted string as null");
        }
        catch (NullPointerException success) {
            // success
        }
View Full Code Here

        }
        catch (NullPointerException success) {
            // success
        }
       
        element.insertChild("" , 0);
        // empty node should be created
        assertEquals(2, element.getChildCount());  

    }
   
View Full Code Here

                        && ((prevSibling = parentAsElt.getChild(tableIndex - 1)) instanceof Text)) {
                    Text prevAsText = (Text) prevSibling;
                    prevAsText.setValue(prevAsText.getValue() + text);
                    return;
                }
                parentAsElt.insertChild(nodeFactory.makeText(text), tableIndex);
                cachedTableIndex++;
                return;
            }
            int childCount = stackParent.getChildCount();
            Node lastChild;
View Full Code Here

                        && ((prevSibling = parentAsElt.getChild(tableIndex - 1)) instanceof Text)) {
                    Text prevAsText = (Text) prevSibling;
                    prevAsText.setValue(prevAsText.getValue() + text);
                    return;
                }
                parentAsElt.insertChild(nodeFactory.makeText(text), tableIndex);
                cachedTableIndex++;
                return;
            }
            int childCount = stackParent.getChildCount();
            Node lastChild;
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.