Package org.jaxen.dom

Examples of org.jaxen.dom.DOMXPath.selectNodes()


        z.appendChild(c);

        List context = new ArrayList();
        context.add(b);
        context.add(c);
        List result = xpath.selectNodes(context);
        assertEquals(z, result.get(0));
    }
   
}
View Full Code Here


        root.appendChild(child);
        // different prefix
        child.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:foo2", "http://www.contradictory.org");
       
        XPath xpath = new DOMXPath("//namespace::node()");
        List result = xpath.selectNodes(doc);
        assertEquals(4, result.size());
       
    }

    // see JAXEN-105
View Full Code Here

        root.appendChild(child);
        // same prefix
        child.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:foo", "http://www.contradictory.org");
       
        XPath xpath = new DOMXPath("//namespace::node()");
        List result = xpath.selectNodes(doc);
        assertEquals(3, result.size());
       
    }

    // see JAXEN-105
View Full Code Here

        root.appendChild(child);
        // same prefix
        child.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:foo", "http://www.contradictory.org");
       
        XPath xpath = new DOMXPath("//namespace::node()[name(.)='foo']");
        List result = xpath.selectNodes(doc);
        assertEquals(1, result.size());
        Node node = (Node) result.get(0);
        assertEquals("http://www.example.org", node.getNodeValue());
       
    }   
View Full Code Here

        root.setAttributeNS("http://www.example.org/", "foo:a", "value");
        // same prefix, different namespace
        root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:foo", "http://www.contradictory.org");
       
        XPath xpath = new DOMXPath("//namespace::node()[name(.)='foo']");
        List result = xpath.selectNodes(doc);
        assertEquals(1, result.size());
        Node node = (Node) result.get(0);
        assertEquals("http://www.example.org/", node.getNodeValue());
       
    }   
View Full Code Here

        doc.appendChild(root);
        // same prefix
        root.setAttributeNS("http://www.contradictory.org", "pre:foo", "value");
       
        XPath xpath = new DOMXPath("//namespace::node()[name(.)='pre']");
        List result = xpath.selectNodes(doc);
        assertEquals(1, result.size());
        Node node = (Node) result.get(0);
        assertEquals("http://www.example.org", node.getNodeValue());
       
    }   
View Full Code Here

        doc.appendChild(root);
        root.appendChild(doc.createComment("data"));
       
        DOMXPath xpath = new DOMXPath( "//comment()" );
       
        List results = xpath.selectNodes(doc);
        Node backroot = (Node) results.get(0);
        backroot.setNodeValue("test");
        assertEquals("test", backroot.getNodeValue());
       
    }
View Full Code Here

        DocumentBuilder builder = factory.newDocumentBuilder();
   
        Document document = builder.parse( BASIC_XML );

        List results = xpath.selectNodes( document );

        assertEquals( 3,
                      results.size() );

        Iterator iter = results.iterator();
View Full Code Here

       
        XPath xpath = new DOMXPath( "//c/preceding::*[1][name()='d']" );
        DocumentBuilder builder = factory.newDocumentBuilder();
   
        Document document = builder.parse( "xml/web2.xml" );
        List result = xpath.selectNodes(document);
        assertEquals(1, result.size());
       
    }
   
    
View Full Code Here

        XPath implicitCast = new DOMXPath("//lat[(text() >= 37)]");
        XPath explicitCast = new DOMXPath("//lat[(number(text()) >= 37)]");
        DocumentBuilder builder = factory.newDocumentBuilder();
        ByteArrayInputStream in = new ByteArrayInputStream("<geo><lat>39</lat></geo>".getBytes("UTF-8"));
        Document document = builder.parse(in);
        List result = explicitCast.selectNodes(document);
        assertEquals(1, result.size());
        result = implicitCast.selectNodes(document);
        assertEquals(1, result.size());
    }
   
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.