Package org.jaxen.dom

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


    public void testNamespaceURIOfTextIsEmptyString() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/*/text())" );
        Text c = doc.createTextNode("test");
        doc.getDocumentElement().appendChild(c);
        String result = (String) xpath.evaluate(doc);
        assertEquals("", result);
    }   

    public void testNamespaceURIRequiresAtMostOneArgument() throws JaxenException
    {
View Full Code Here


    public void testNamespaceURIRequiresAtMostOneArgument() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/*, /*)" );
        try {
            xpath.evaluate(doc);
            fail("Allowed namespace-uri function with no arguments");
        }
        catch (FunctionCallException ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

    }   

    public void testNamespaceURIOfNamespaceIsNull() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/*/namespace::node())" );
        String result = (String) xpath.evaluate(doc);
        assertEquals("", result);
    }
   
    public void testNamespaceURIOfComment()
      throws JaxenException {
View Full Code Here

       
        XPath xpath = new DOMXPath("namespace-uri(/a/comment())");
        Document document = builder.getDOMImplementation().createDocument(null, "a", null);
        document.getDocumentElement().appendChild(document.createComment("data"));
       
        String result = (String) xpath.evaluate(document);
        assertEquals("", result);
       
    }

}
View Full Code Here

    public void testEvaluateString() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("string(/*)");
       
        doc.appendChild(doc.createElement("root"));
        String stringValue = (String) xpath.evaluate(doc);
        assertEquals("", stringValue);
       
    }
   
   
View Full Code Here

    public void testEvaluateWithMultiNodeAnswer() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("(/descendant-or-self::node())");
       
        doc.appendChild(doc.createElement("root"));
        List result = (List) xpath.evaluate(doc);
        assertEquals(2, result.size());
       
    }
   
   
View Full Code Here

       
    }
   
    public void testArithmeticAssociativity() throws JaxenException {
        XPath xpath = new DOMXPath("2+1-1+1");
        Double result = (Double) xpath.evaluate(doc);
        assertEquals(3, result.intValue());
    }
   
    public void testLogicalAssociativity() throws JaxenException {
        XPath xpath = new DOMXPath("false() or true() and true() and false()");
View Full Code Here

        assertEquals(3, result.intValue());
    }
   
    public void testLogicalAssociativity() throws JaxenException {
        XPath xpath = new DOMXPath("false() or true() and true() and false()");
        Boolean result = (Boolean) xpath.evaluate(doc);
        assertFalse(result.booleanValue());
    }
   
    public void testRelationalAssociativity3() throws JaxenException {
        XPath xpath = new DOMXPath("3 > 2 > 1");
View Full Code Here

        assertFalse(result.booleanValue());
    }
   
    public void testRelationalAssociativity3() throws JaxenException {
        XPath xpath = new DOMXPath("3 > 2 > 1");
        Boolean result = (Boolean) xpath.evaluate(doc);
        assertFalse(result.booleanValue());
    }
   
    public void testRelationalAssociativity4() throws JaxenException {
        XPath xpath = new DOMXPath("4 > 3 > 2 > 1");
View Full Code Here

        assertFalse(result.booleanValue());
    }
   
    public void testRelationalAssociativity4() throws JaxenException {
        XPath xpath = new DOMXPath("4 > 3 > 2 > 1");
        Boolean result = (Boolean) xpath.evaluate(doc);
        assertFalse(result.booleanValue());
    }
   
    public void testRelationalGTAssociativity5() throws JaxenException {
        XPath xpath = new DOMXPath("5 > 4 > 3 > 2 > 1");
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.