org.eclipse.jet.xpath
Interface XPathExpression


public interface XPathExpression

Interface to a compiled XPath expression.

Note: Once JET moves to Java 1.5 or later only, this interface will be migrated to javax.xml.xpath.XPathExpression


Method Summary
 java.lang.Object evaluate(java.lang.Object contextObject)
          Evaluate the expression and return the 'natural' result of the expression.
 boolean evaluateAsBoolean(java.lang.Object contextObject)
          Evaluate the expression and convert the result to a boolean using the XPath boolean function.
 NodeSet evaluateAsNodeSet(java.lang.Object contextObject)
          Evaluate the expression and return the result as a Node set.
 double evaluateAsNumber(java.lang.Object contextObject)
          Evaluate the expression and convert the result to a number using the XPath number function.
 java.lang.Object evaluateAsSingleNode(java.lang.Object contextObject)
          Evaluate the expression using XPathExpression.evaluateAsNodeSet(Object) and then return the first object in the node set.
 java.lang.String evaluateAsString(java.lang.Object contextObject)
          Evaluate the expression and convert the result to a String using the XPath String function
 

Method Detail

evaluateAsString

public java.lang.String evaluateAsString(java.lang.Object contextObject)
                                  throws XPathRuntimeException
Evaluate the expression and convert the result to a String using the XPath String function

Parameters:
contextObject - the context object for the expression
Returns:
the expression result.
Throws:
XPathRuntimeException - if an evaluation error occures
See Also:
XPathUtil#xpathString(Object)

evaluateAsBoolean

public boolean evaluateAsBoolean(java.lang.Object contextObject)
                          throws XPathRuntimeException
Evaluate the expression and convert the result to a boolean using the XPath boolean function.

Parameters:
contextObject - the context object for the expression
Returns:
the expression result.
Throws:
XPathRuntimeException - if an evaluation error occures
See Also:
XPathUtil.xpathBoolean(Object)

evaluateAsNumber

public double evaluateAsNumber(java.lang.Object contextObject)
                        throws XPathRuntimeException
Evaluate the expression and convert the result to a number using the XPath number function.

Parameters:
contextObject - the context object for the expression.
Returns:
the expression result
Throws:
XPathRuntimeException - if an evaluation error occures
See Also:
XPathUtil.xpathNumber(Object)

evaluateAsNodeSet

public NodeSet evaluateAsNodeSet(java.lang.Object contextObject)
                          throws XPathRuntimeException
Evaluate the expression and return the result as a Node set. If the result cannot be converted to a node set, then an exception is thrown.

Parameters:
contextObject - the context object for the expression.
Returns:
the expression result
Throws:
XPathRuntimeException - if an evaluation error occures

evaluateAsSingleNode

public java.lang.Object evaluateAsSingleNode(java.lang.Object contextObject)
                                      throws XPathRuntimeException
Evaluate the expression using XPathExpression.evaluateAsNodeSet(Object) and then return the first object in the node set. An exception is thrown if the expression cannot be converted to a node set. If the resulting node set is empty, then null is returned.

Parameters:
contextObject - the context object for the expression.
Returns:
the first element in the node set or null if the node set is empty.
Throws:
XPathRuntimeException - if an evaluation error occures

evaluate

public java.lang.Object evaluate(java.lang.Object contextObject)
                          throws XPathRuntimeException
Evaluate the expression and return the 'natural' result of the expression. The result may be any of:

Parameters:
contextObject - the context object for the expression.
Returns:
the expression result
Throws:
XPathRuntimeException - if an evaluation error occures

Copyright 2006 IBM Corporation and others.
All Rights Reserved.