Package org.jaxen

Examples of org.jaxen.XPath.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

        Text b = doc.createTextNode("ready");
        a.appendChild(b);
       
        XPath xpath = new DOMXPath("..");
        try {
            xpath.evaluate("String");
            fail("Allowed String as context");
        }
        catch (ClassCastException ex) {
            // success
        }
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

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