| java.lang.Object org.apache.xpath.jaxp.XPathExpressionImpl
XPathExpressionImpl | public class XPathExpressionImpl implements javax.xml.xpath.XPathExpression(Code) | | The XPathExpression interface encapsulates a (compiled) XPath expression.
version: $Revision: 1.1 $ author: Ramesh Mandava |
Method Summary | |
public Object | eval(Object item, QName returnType) | public Object | evaluate(Object item, QName returnType) Evaluate the compiled XPath expression in the specified context and
return the result as the specified type.
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If returnType is not one of the types defined
in
XPathConstants ,
then an IllegalArgumentException is thrown.
If a null value is provided for
item , an empty document will be used for the
context.
If returnType is null , then a
NullPointerException is thrown.
Parameters: item - The starting context (node or node list, for example). Parameters: returnType - The desired return type. | public String | evaluate(Object item) Evaluate the compiled XPath expression in the specified context and
return the result as a String .
This method calls
XPathExpressionImpl.evaluate(Object item,QName returnType) with a returnType of
XPathConstants.STRING .
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If a null value is provided for
item , an empty document will be used for the
context.
Parameters: item - The starting context (node or node list, for example). | public Object | evaluate(InputSource source, QName returnType) Evaluate the compiled XPath expression in the context of the
specified InputSource and return the result as the
specified type.
This method builds a data model for the
InputSource and calls
XPathExpressionImpl.evaluate(Object item,QName returnType) on the resulting
document object.
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If returnType is not one of the types defined in
XPathConstants ,
then an IllegalArgumentException is thrown.
If source or returnType is null ,
then a NullPointerException is thrown.
Parameters: source - The InputSource of the document to evaluateover. Parameters: returnType - The desired return type. | public String | evaluate(InputSource source) Evaluate the compiled XPath expression in the context of the specified InputSource and return the result as a
String .
This method calls
XPathExpressionImpl.evaluate(InputSource source,QName returnType) with a returnType of
XPathConstants.STRING .
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If source is null , then a NullPointerException is thrown.
Parameters: source - The InputSource of the document to evaluate over. | public void | setXPath(org.apache.xpath.XPath xpath) |
XPathExpressionImpl | protected XPathExpressionImpl()(Code) | | Protected constructor to prevent direct instantiation; use compile()
from the context.
|
evaluate | public Object evaluate(Object item, QName returnType) throws XPathExpressionException(Code) | | Evaluate the compiled XPath expression in the specified context and
return the result as the specified type.
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If returnType is not one of the types defined
in
XPathConstants ,
then an IllegalArgumentException is thrown.
If a null value is provided for
item , an empty document will be used for the
context.
If returnType is null , then a
NullPointerException is thrown.
Parameters: item - The starting context (node or node list, for example). Parameters: returnType - The desired return type. The Object that is the result of evaluating theexpression and converting the result toreturnType . throws: XPathExpressionException - If the expression cannot be evaluated. throws: IllegalArgumentException - If returnType is not oneof the types defined in XPathConstants. throws: NullPointerException - If returnType isnull . |
evaluate | public String evaluate(Object item) throws XPathExpressionException(Code) | | Evaluate the compiled XPath expression in the specified context and
return the result as a String .
This method calls
XPathExpressionImpl.evaluate(Object item,QName returnType) with a returnType of
XPathConstants.STRING .
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If a null value is provided for
item , an empty document will be used for the
context.
Parameters: item - The starting context (node or node list, for example). The String that is the result of evaluating theexpression and converting the result to aString . throws: XPathExpressionException - If the expression cannot be evaluated. |
evaluate | public Object evaluate(InputSource source, QName returnType) throws XPathExpressionException(Code) | | Evaluate the compiled XPath expression in the context of the
specified InputSource and return the result as the
specified type.
This method builds a data model for the
InputSource and calls
XPathExpressionImpl.evaluate(Object item,QName returnType) on the resulting
document object.
See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
for context item evaluation,
variable, function and QName resolution and return type conversion.
If returnType is not one of the types defined in
XPathConstants ,
then an IllegalArgumentException is thrown.
If source or returnType is null ,
then a NullPointerException is thrown.
Parameters: source - The InputSource of the document to evaluateover. Parameters: returnType - The desired return type. The Object that is the result of evaluating theexpression and converting the result toreturnType . throws: XPathExpressionException - If the expression cannot be evaluated. throws: IllegalArgumentException - If returnType is not oneof the types defined in XPathConstants. throws: NullPointerException - If source or returnType is null . |
|
|