Package org.jaxen.dom

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


  public Object selectObject(Node contextNode, String expression) throws JRException
  {
    try
    {
      XPath xpath = new DOMXPath(expression);
      Object object = xpath.evaluate(contextNode);
      Object value;
      if (object instanceof List)
      {
        List list = (List) object;
        if (list.isEmpty())
View Full Code Here


        }
        try
        {
            XPath xpath = new DOMXPath( xpathExpr.getValue() );
            xpath.setNamespaceContext( new JaxenNamespaceContext( xpathExpr.getNamespaceContext() ) );
            return xpath.evaluate( evalContextNode );
        }
        catch ( JaxenException je )
        {
            throw new QueryEvaluationErrorException( MSG.getMessage( Keys.XPATH_FAILED, xpathExpr.getValue(),
                    je ) );
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

    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

        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.