Class XPathExpressionImpl
- All Implemented Interfaces:
XPathExpression
public class XPathExpressionImpl extends Object implements XPathExpression
- Version:
- $Revision: 524813 $
- Author:
- Ramesh Mandava
-
Constructor Summary
Constructors Modifier Constructor Description protectedXPathExpressionImpl()Protected constructor to prevent direct instantiation; use compile() from the context.protectedXPathExpressionImpl(XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver)protectedXPathExpressionImpl(XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver, boolean featureSecureProcessing) -
Method Summary
Modifier and Type Method Description Objecteval(Object item, QName returnType)Stringevaluate(Object item)Evaluate the compiled XPath expression in the specified context and return the result as aString.Objectevaluate(Object item, QName returnType)Evaluate the compiled XPath expression in the specified context and return the result as the specified type.Stringevaluate(InputSource source)Evaluate the compiled XPath expression in the context of the specifiedInputSourceand return the result as aString.Objectevaluate(InputSource source, QName returnType)Evaluate the compiled XPath expression in the context of the specifiedInputSourceand return the result as the specified type.voidsetXPath(XPath xpath)
-
Constructor Details
-
XPathExpressionImpl
protected XPathExpressionImpl()Protected constructor to prevent direct instantiation; use compile() from the context. -
XPathExpressionImpl
protected XPathExpressionImpl(XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver) -
XPathExpressionImpl
protected XPathExpressionImpl(XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver, boolean featureSecureProcessing)
-
-
Method Details
-
setXPath
-
eval
- Throws:
TransformerException
-
evaluate
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
returnTypeis not one of the types defined inXPathConstants, then anIllegalArgumentExceptionis thrown.If a
nullvalue is provided foritem, an empty document will be used for the context. IfreturnTypeisnull, then aNullPointerExceptionis thrown.- Specified by:
evaluatein interfaceXPathExpression- Parameters:
item- The starting context (node or node list, for example).returnType- The desired return type.- Returns:
- The
Objectthat is the result of evaluating the expression and converting the result toreturnType. - Throws:
XPathExpressionException- If the expression cannot be evaluated.IllegalArgumentException- IfreturnTypeis not one of the types defined inXPathConstants.NullPointerException- IfreturnTypeisnull.
-
evaluate
Evaluate the compiled XPath expression in the specified context and return the result as a
String.This method calls
evaluate(Object item, QName returnType)with areturnTypeofXPathConstants.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
nullvalue is provided foritem, an empty document will be used for the context.- Specified by:
evaluatein interfaceXPathExpression- Parameters:
item- The starting context (node or node list, for example).- Returns:
- The
Stringthat is the result of evaluating the expression and converting the result to aString. - Throws:
XPathExpressionException- If the expression cannot be evaluated.
-
evaluate
Evaluate the compiled XPath expression in the context of the specified
InputSourceand return the result as the specified type.This method builds a data model for the
InputSourceand callsevaluate(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
returnTypeis not one of the types defined inXPathConstants, then anIllegalArgumentExceptionis thrown.If
sourceorreturnTypeisnull, then aNullPointerExceptionis thrown.- Specified by:
evaluatein interfaceXPathExpression- Parameters:
source- TheInputSourceof the document to evaluate over.returnType- The desired return type.- Returns:
- The
Objectthat is the result of evaluating the expression and converting the result toreturnType. - Throws:
XPathExpressionException- If the expression cannot be evaluated.IllegalArgumentException- IfreturnTypeis not one of the types defined inXPathConstants.NullPointerException- IfsourceorreturnTypeisnull.
-
evaluate
Evaluate the compiled XPath expression in the context of the specified
InputSourceand return the result as aString.This method calls
evaluate(InputSource source, QName returnType)with areturnTypeofXPathConstants.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
sourceisnull, then aNullPointerExceptionis thrown.- Specified by:
evaluatein interfaceXPathExpression- Parameters:
source- TheInputSourceof the document to evaluate over.- Returns:
- The
Stringthat is the result of evaluating the expression and converting the result to aString. - Throws:
XPathExpressionException- If the expression cannot be evaluated.NullPointerException- Ifsourceisnull.
-