Package org.jaxen.dom

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


        b.appendChild(x3);
        x2.appendChild(doc.createTextNode("2"));
        x3.appendChild(doc.createTextNode("3"));
        x4.appendChild(doc.createTextNode("4"));
       
        List result = xpath.selectNodes(doc);
        assertEquals(6, result.size());
       
    }   
      
    public void testUnionOfNodesWithNonNodes() throws JaxenException {
View Full Code Here


        x2.appendChild(doc.createTextNode("2"));
        x3.appendChild(doc.createTextNode("3"));
        x4.appendChild(doc.createTextNode("4"));
       
        try {
            xpath.selectNodes(doc);
            fail("Allowed union with non-node-set");
        }
        catch (JaxenException ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

        org.w3c.dom.Element x2 = doc.createElementNS("", "x");
        b.appendChild(x2);
        x2.appendChild(doc.createTextNode("2"));
       
        try {
            xpath.selectNodes(doc);
            fail("Allowed union with non-node-set");
        }
        catch (JaxenException ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

      throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("/b/c");
        org.w3c.dom.Element a = doc.createElementNS("", "a");
        doc.appendChild(a);
        List result = xpath.selectNodes(doc);
        assertTrue(! xpath.booleanValueOf(result));
       
    }
   
    public void testAddNamespaceWithNonSimpleNamespaceContext() throws JaxenException {
View Full Code Here

        b.appendChild(x3);
        x2.appendChild(doc.createTextNode("2"));
        x3.appendChild(doc.createTextNode("3"));
        x4.appendChild(doc.createTextNode("4"));
       
        List result = xpath.selectNodes(doc);
        assertEquals(6, result.size());
        assertEquals(a, result.get(0));  
        assertEquals(x1, result.get(1));  
        assertEquals(b, result.get(2));  
        assertEquals(x2, result.get(3));  
View Full Code Here

    public void testSumOfNumber() throws JaxenException
    {
        try
        {
            XPath xpath = new DOMXPath( "sum(3)" );
            xpath.selectNodes( doc );
            fail("sum of non-node-set");
        }
        catch (FunctionCallException e)
        {
            assertEquals("The argument to the sum function must be a node-set", e.getMessage());
View Full Code Here

    public void testSumNoArguments() throws JaxenException
    {
        try
        {
            XPath xpath = new DOMXPath( "sum()" );
            xpath.selectNodes( doc );
            fail("sum of nothing");
        }
        catch (FunctionCallException e)
        {
            assertEquals("sum() requires one argument.", e.getMessage());
View Full Code Here

       DocumentBuilder builder = factory.newDocumentBuilder();
       Document doc = builder.parse( "xml/basic.xml" );
       Element root = doc.getDocumentElement();
       root.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:lang", "en");
       XPath xpath = new DOMXPath( "/*/@xml:lang" );
       List result = xpath.selectNodes( doc );
       assertEquals(1, result.size());

    }   

   
View Full Code Here

           
            XPath xpath = new DOMXPath( args[1] );

            System.out.println( "XPah:h " + xpath );
           
            List results = xpath.selectNodes( doc );

            Iterator resultIter = results.iterator();
           
            System.out.println("Document :: " + args[0] );
            System.out.println("   XPath :: " + args[1] );
View Full Code Here

        Element child = doc.createElementNS("http://www.example.org", "child");
        child.setAttributeNS("http://www.w3.org/2000/xmlns/" , "xmlns:pre", "value");
        root.appendChild(child);
       
        XPath xpath = new DOMXPath("namespace::node()");
        List result = xpath.selectNodes(child);
        assertEquals(3, result.size());
  
    }
   
    public void testNumberOfNamespaceNodes() throws JaxenException {
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.