Package org.jaxen

Examples of org.jaxen.XPath.evaluate()


    }   
 
    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


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

    Map<String,String> namespaces,
    Map<QName,Function> functions,
    Map<QName,Object> variables) throws XPathException {
    try {
      XPath xpath = getXPath(path, namespaces, functions, variables);
      return xpath.evaluate(base);
    } catch (JaxenException e) {
      throw new XPathException(e);
    }
  }
View Full Code Here

 
    public void testSubstringOfEmptyString() throws JaxenException
    {
        XPath xpath = new DOMXPath( "substring('', 2)" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("", result);
    }   
 
    public void testSubstringWithNegativeLength() throws JaxenException
View Full Code Here

 
    public void testSubstringWithNegativeLength() throws JaxenException
    {
        XPath xpath = new DOMXPath( "substring('12345', 2, -3)" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("", result);
    }   
 
    public void testSubstringWithExcessiveLength() throws JaxenException
View Full Code Here

 
    public void testSubstringWithExcessiveLength() throws JaxenException
    {
        XPath xpath = new DOMXPath( "substring('12345', 2, 32)" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("2345", result);
    }   
 
    public void testSubstringWithNegativeLength2() throws JaxenException
View Full Code Here

 
    public void testSubstringWithNegativeLength2() throws JaxenException
    {
        XPath xpath = new DOMXPath( "substring('12345', 2, -1)" );
        String result = (String) xpath.evaluate( doc );
        assertEquals("", result);
    }   
 
    public void testSubstringFunctionRequiresAtLeastTwoArguments()
View Full Code Here

    public void testNegativeStartNoLength()
      throws JaxenException {
       
        XPath xpath = new DOMXPath("substring('Hello', -50)");
        String result = (String) xpath.evaluate( doc );
        assertEquals("Hello", result);
       
    }   

    public void testNegativeStartWithLength()
View Full Code Here

    public void testNegativeStartWithLength()
      throws JaxenException {
       
        XPath xpath = new DOMXPath("substring('Hello', -50, 20)");
        String result = (String) xpath.evaluate( doc );
        assertEquals("", result);
       
    }   

    public void testSubstringFunctionRequiresAtMostThreeArguments()
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.