Package org.jaxen.dom

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


        Boolean result2 = (Boolean) xpath2.evaluate(null);
        assertTrue(result2.booleanValue());
       
        String expr = xpath1.getRootExpr().getText();
        DOMXPath xpath3 = new DOMXPath(expr);
        Boolean result3 = (Boolean) xpath3.evaluate(null);
        assertEquals(expr, result1, result3);
        assertFalse(expr, result3.booleanValue());
     
    }
View Full Code Here


        b.appendChild(x3);
        x2.appendChild(doc.createTextNode("fr"));
        x3.appendChild(doc.createTextNode("3"));
        x4.appendChild(doc.createTextNode("4"));
       
        Boolean result = (Boolean) xpath.evaluate(doc);
        assertEquals(Boolean.FALSE, result);
       
    }   

    public void testLangFunctionSelectsNumber()
View Full Code Here

    }

    private void assertValueOfXPath(String expected, Object context, String xpathStr) throws JaxenException
    {
            DOMXPath xpath = new DOMXPath(xpathStr);
            Object node = xpath.evaluate(getContext(context));
            String result = StringFunction.evaluate(node,
                    getNavigator());
            log(debug,
                    "  Select :: " + xpathStr);
            log(debug,
View Full Code Here

       
        XPath xpath = new DOMXPath( "name(//c/preceding::*[1])" );
        DocumentBuilder builder = factory.newDocumentBuilder();
   
        doc = builder.parse("xml/web2.xml");
        Object result = xpath.evaluate(doc);
        assertEquals("d", result);
    }
   
    
    public void testPrecedingAxisInDocumentOrder()
View Full Code Here

    }

    public void testTranslate() throws JaxenException
    {
        XPath xpath = new DOMXPath( "translate('abc', 'b', 'd')" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("adc", result);
    }   
 
    public void testTranslateIgnoresExtraArguments() throws JaxenException
    {
View Full Code Here

    }   
 
    public void testTranslateIgnoresExtraArguments() throws JaxenException
    {
        XPath xpath = new DOMXPath( "translate('abc', 'b', 'dghf')" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("adc", result);
    }   
 
    public void testTranslateFunctionRequiresAtLeastThreeArguments()
      throws JaxenException {
View Full Code Here

    }  
   
    public void testTranslateStringThatContainsNonBMPChars() throws JaxenException
    {
        XPath xpath = new DOMXPath( "translate('ab\uD834\uDD00b', 'b', 'd')" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("ad\uD834\uDD00d", result);
    }
   

    public void testTranslateNonBMPChars() throws JaxenException
View Full Code Here

        factory.setNamespaceAware(true);
        Document doc = factory.newDocumentBuilder().newDocument();
        Element root = doc.createElement("root");
        doc.appendChild(root);
       
        Double result = (Double) xpath.evaluate(doc);
        assertEquals(0.5, result.doubleValue(), 0.000001);
       
    }
}
View Full Code Here

    }

    public void testStringLengthOfNumber() throws JaxenException
    {
        XPath xpath = new DOMXPath( "string-length(3)" );
        Double result = (Double) xpath.evaluate( doc );
        assertEquals(1, result.intValue());
    }   
 
    public void testStringLengthOfEmptyString() throws JaxenException
    {
View Full Code Here

    }   
 
    public void testStringLengthOfEmptyString() throws JaxenException
    {
        XPath xpath = new DOMXPath( "string-length('')" );
        Double result = (Double) xpath.evaluate( doc );
        assertEquals(0, result.intValue());
    }   
 
    public void testStringLengthOfString() 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.