Evaluate an XPath expression in the context of the specified
InputSource
and return the result as the specified type.
Evaluate an 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
XPath.evaluate(String expression, Object item, QName returnType)
on the resulting document object.
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 expression
, source
or returnType
is null
,
then a NullPointerException
is thrown.
Returns:
The
Object
that encapsulates the result of evaluating the expression.
Parameters:
-
expression - The XPath expression.
-
source - The input source of the document to evaluate over.
-
returnType - The desired return type.
Throws:
-
XPathExpressionException - If expression cannot be evaluated.
-
IllegalArgumentException - If
returnType
is not one of the types defined in {@link XPathConstants}.
-
NullPointerException - If
expression
,
source
or
returnType
is
null
.