Package org.springframework.xml.xpath
Class AbstractXPathTemplate
java.lang.Object
org.springframework.xml.transform.TransformerObjectSupport
org.springframework.xml.xpath.AbstractXPathTemplate
- All Implemented Interfaces:
XPathOperations
- Direct Known Subclasses:
JaxenXPathTemplate
,Jaxp13XPathTemplate
public abstract class AbstractXPathTemplate
extends TransformerObjectSupport
implements XPathOperations
Abstract base class for implementations of
XPathOperations
. Contains a namespaces property.- Since:
- 1.0.0
- Author:
- Arjen Poutsma
-
Field Summary
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
evaluate
(String expression, Source context, NodeCallbackHandler callbackHandler) Evaluates the given expression, handling the resultNode
objects on a per-node basis with aNodeCallbackHandler
.Returns namespaces used in the XPath expression.protected Element
getRootElement
(Source source) Returns the root element of the given source.void
setNamespaces
(Map<String, String> namespaces) Sets namespaces used in the XPath expression.Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.xml.xpath.XPathOperations
evaluate, evaluateAsBoolean, evaluateAsDouble, evaluateAsNode, evaluateAsNodeList, evaluateAsObject, evaluateAsString
-
Constructor Details
-
AbstractXPathTemplate
public AbstractXPathTemplate()
-
-
Method Details
-
getNamespaces
Returns namespaces used in the XPath expression. -
setNamespaces
Sets namespaces used in the XPath expression. Maps prefixes to namespaces. -
evaluate
public final void evaluate(String expression, Source context, NodeCallbackHandler callbackHandler) throws XPathException Description copied from interface:XPathOperations
Evaluates the given expression, handling the resultNode
objects on a per-node basis with aNodeCallbackHandler
.- Specified by:
evaluate
in interfaceXPathOperations
- Parameters:
expression
- the XPath expressioncontext
- the context starting pointcallbackHandler
- object that will extract results, one row at a time- Throws:
XPathException
- in case of XPath errors- See Also:
-
getRootElement
Returns the root element of the given source.- Parameters:
source
- the source to get the root element from- Returns:
- the root element
- Throws:
TransformerException
-