Examples of DOMXPath


Examples of org.jaxen.dom.DOMXPath

       
    }   
   
    public void testMultipleAttributesOnElement() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("/descendant::x/@*");
        org.w3c.dom.Element a = doc.createElementNS("", "a");
        org.w3c.dom.Element b = doc.createElementNS("", "b");
        doc.appendChild(a);
        org.w3c.dom.Element x1 = doc.createElementNS("", "x");
        a.appendChild(x1);
        a.appendChild(b);
       
        Attr a1 = doc.createAttribute("name1");
        a1.setNodeValue("1");
        x1.setAttributeNode(a1);
        Attr a2 = doc.createAttribute("name2");
        a2.setNodeValue("2");
        x1.setAttributeNode(a2);
        Attr a3 = doc.createAttribute("name3");
        a3.setNodeValue("3");
        x1.setAttributeNode(a3);
        Attr a4 = doc.createAttribute("name4");
        a4.setNodeValue("4");
        x1.setAttributeNode(a4);
       
        List result = xpath.selectNodes(doc);
        assertEquals(4, result.size());
        assertTrue(result.contains(a1));
        assertTrue(result.contains(a2));
        assertTrue(result.contains(a3));
        assertTrue(result.contains(a4));
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.