Package nu.xom

Examples of nu.xom.Nodes


        parent.appendChild(child);
       
        Element test = new Element("test");
        test.addAttribute(new Attribute("pre:test", "http://www.example.org", "value"));
        XPathContext context = XPathContext.makeNamespaceContext(test);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
    }
View Full Code Here


        parent.appendChild(child);
       
        Element test = new Element("test");
        test.addNamespaceDeclaration("pre", "http://www.example.org");
        XPathContext context = XPathContext.makeNamespaceContext(test);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
    }
View Full Code Here

       
        Element test = new Element("pre:test", "http://www.example.org");
        Element testChild = new Element("testchild");
        test.appendChild(testChild);
        XPathContext context = XPathContext.makeNamespaceContext(testChild);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
    }
View Full Code Here

        Element test = new Element("test");
        test.addAttribute(new Attribute("pre:test", "http://www.example.org", "value"));
        Element testChild = new Element("testchild");
        test.appendChild(testChild);
        XPathContext context = XPathContext.makeNamespaceContext(testChild);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
    }
View Full Code Here

        Element test = new Element("test");
        test.addNamespaceDeclaration("pre", "http://www.example.org");
        Element testChild = new Element("testchild");
        test.appendChild(testChild);
        XPathContext context = XPathContext.makeNamespaceContext(testChild);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
    }
View Full Code Here

        parent.appendChild(child);
        child.addAttribute(att);
       
        XPathContext context = new XPathContext("pre", "http://www.example.org");
        context.addNamespace("c", "http://www.cafeconleche.org/");
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));
       
        result = child.query("@c:*", context);
        assertEquals(1, result.size());
        assertEquals(att, result.get(0));
       
    }
View Full Code Here

        element.appendChild(child);
        element.appendChild(t5);
        element.appendChild(t6);
        element.appendChild(t7);
       
        Nodes result = element.query("./text()[contains(., 'o')]");
        assertEquals(7, result.size());
        assertEquals(t1, result.get(0));
        assertEquals(t2, result.get(1));
        assertEquals(t3, result.get(2));
        assertEquals(t4, result.get(3));
        assertEquals(t5, result.get(4));
        assertEquals(t6, result.get(5));
        assertEquals(t7, result.get(6));
       
       
    }
View Full Code Here

        parent.appendChild(child);
        child.appendChild("1");
        child.appendChild("2");
       
        XPathContext context = new XPathContext("pre", "http://www.example.org");
        Nodes result = parent.query("descendant::text()", context);
        assertEquals(2, result.size());
        assertEquals("1", result.get(0).getValue());  
        assertEquals("2", result.get(1).getValue());  
       
    }
View Full Code Here

       
        Element parent = new Element("Test", "http://www.example.org");
        Element child = new Element("child", "http://www.example.org");
        parent.appendChild(child);
       
        Nodes result = parent.query("child");
        assertEquals(0, result.size());  
       
    }
View Full Code Here

       
        Element parent = new Element("Test");
        parent.appendChild("test");
        parent.appendChild("again");
       
        Nodes result = parent.query("text()");
        assertEquals(2, result.size());
        assertEquals("test", result.get(0).getValue());  
        assertEquals("again", result.get(1).getValue());  
       
    }
View Full Code Here

TOP

Related Classes of nu.xom.Nodes

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.