Evaluate the compiled XPath expression in the specified context and return the result as the specified type.
See Evaluation of XPath Expressions 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.
Returns:
The
Object that is the result of evaluating the expression and converting the result to
returnType.
Parameters:
-
item - The starting context (a node, for example).
-
returnType - The desired return type.
Throws:
-
XPathExpressionException - If the expression cannot be evaluated.
-
IllegalArgumentException - If
returnType is not one of the types defined in {@link XPathConstants}.
-
NullPointerException - If
returnType is
null.