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 {@link 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.
@param item The starting context (node or node list, for example).
@param returnType The desired return type.
@return The
Object
that is the result of evaluating the expression and converting the result to
returnType
.
@throws XPathExpressionException If the expression cannot be evaluated.
@throws IllegalArgumentException If
returnType
is not one of the types defined in {@link XPathConstants}.
@throws NullPointerException If
returnType
is
null
.