Package nu.xom

Examples of nu.xom.Element.appendChild()


    public void testWhiteSpaceIsAllowedBetweenTokens() {
       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        Nodes nodes = doc.query("// a");
        assertEquals(0, nodes.size());
       
View Full Code Here


    public void testTextChildInPredicate() {
       
        Element item = new Element("item");
        Document doc = new Document(item);
        Element name = new Element("name");
        name.appendChild("a");
        item.appendChild(name);
        Element value = new Element("value");
        value.appendChild("b");
        item.appendChild(value);
        Nodes result = doc.query("/item[name/text()='a']/value");
View Full Code Here

        Document doc = new Document(item);
        Element name = new Element("name");
        name.appendChild("a");
        item.appendChild(name);
        Element value = new Element("value");
        value.appendChild("b");
        item.appendChild(value);
        Nodes result = doc.query("/item[name/text()='a']/value");
        assertEquals(1, result.size());
        assertEquals("b", result.get(0).getValue());
       
View Full Code Here

   
    public void testSimpleTextChildInPredicate() {
       
        Element item = new Element("item");
        Document doc = new Document(item);
        item.appendChild("a");
        Nodes result = doc.query("/item[text()='a']");
        assertEquals(1, result.size());
       
    }
   
View Full Code Here

    public void testDescendantAxisOrder() {
       
        Element a = new Element("a");
        Document doc = new Document(a);
        Element x1 = new Element("x");
        x1.appendChild("a1");
        Element x2 = new Element("x");
        x2.appendChild("b2");
        Element x3 = new Element("x");
        x3.appendChild("c3");
        Element x4 = new Element("x");
View Full Code Here

        Element a = new Element("a");
        Document doc = new Document(a);
        Element x1 = new Element("x");
        x1.appendChild("a1");
        Element x2 = new Element("x");
        x2.appendChild("b2");
        Element x3 = new Element("x");
        x3.appendChild("c3");
        Element x4 = new Element("x");
        x4.appendChild("d4");
        a.appendChild(x1);
View Full Code Here

        Element x1 = new Element("x");
        x1.appendChild("a1");
        Element x2 = new Element("x");
        x2.appendChild("b2");
        Element x3 = new Element("x");
        x3.appendChild("c3");
        Element x4 = new Element("x");
        x4.appendChild("d4");
        a.appendChild(x1);
        Element b = new Element("b");
        b.appendChild(x2);
View Full Code Here

        Element x2 = new Element("x");
        x2.appendChild("b2");
        Element x3 = new Element("x");
        x3.appendChild("c3");
        Element x4 = new Element("x");
        x4.appendChild("d4");
        a.appendChild(x1);
        Element b = new Element("b");
        b.appendChild(x2);
        b.appendChild(x3);
        a.appendChild(b);
View Full Code Here

        x3.appendChild("c3");
        Element x4 = new Element("x");
        x4.appendChild("d4");
        a.appendChild(x1);
        Element b = new Element("b");
        b.appendChild(x2);
        b.appendChild(x3);
        a.appendChild(b);
        a.appendChild(x4);
        Nodes result = doc.query("//x");
        assertEquals(4, result.size());
View Full Code Here

        Element x4 = new Element("x");
        x4.appendChild("d4");
        a.appendChild(x1);
        Element b = new Element("b");
        b.appendChild(x2);
        b.appendChild(x3);
        a.appendChild(b);
        a.appendChild(x4);
        Nodes result = doc.query("//x");
        assertEquals(4, result.size());
        assertTrue(result.get(0) instanceof Element);
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.