Package org.xmlunit.xpath
Class JAXPXPathEngine
java.lang.Object
org.xmlunit.xpath.JAXPXPathEngine
- All Implemented Interfaces:
XPathEngine
Simplified access to JAXP's XPath API.
-
Constructor Summary
ConstructorDescriptionCreate an XPathEngine that uses JAXP's default XPathFactory withXPathFactoryConfigurer.Default
applied under the covers.Create an XPathEngine that uses a custom XPathFactory. -
Method Summary
Modifier and TypeMethodDescriptionEvaluates an XPath expression and stringifies the result.Evaluates an XPath expression and stringifies the result.selectNodes
(String xPath, Source s) Returns a potentially empty collection of Nodes matching an XPath expression.selectNodes
(String xPath, Node n) Returns a potentially empty collection of Nodes matching an XPath expression.void
setNamespaceContext
(Map<String, String> prefix2Uri) Establish a namespace context.
-
Constructor Details
-
JAXPXPathEngine
Create an XPathEngine that uses a custom XPathFactory.- Parameters:
fac
- the factory to use
-
JAXPXPathEngine
public JAXPXPathEngine()Create an XPathEngine that uses JAXP's default XPathFactory withXPathFactoryConfigurer.Default
applied under the covers.
-
-
Method Details
-
selectNodes
Returns a potentially empty collection of Nodes matching an XPath expression.- Specified by:
selectNodes
in interfaceXPathEngine
- Parameters:
xPath
- the XPath expressions
- the XML source to apply the expression to- Returns:
- matching nodes
-
evaluate
Evaluates an XPath expression and stringifies the result.- Specified by:
evaluate
in interfaceXPathEngine
- Parameters:
xPath
- the XPath expressions
- the XML source to apply the expression to- Returns:
- stringified result
-
selectNodes
Returns a potentially empty collection of Nodes matching an XPath expression.- Specified by:
selectNodes
in interfaceXPathEngine
- Parameters:
xPath
- the XPath expressionn
- the XML source to apply the expression to- Returns:
- matching nodes
-
evaluate
Evaluates an XPath expression and stringifies the result.- Specified by:
evaluate
in interfaceXPathEngine
- Parameters:
xPath
- the XPath expressionn
- the XML source to apply the expression to- Returns:
- stringified result
-
setNamespaceContext
Establish a namespace context.- Specified by:
setNamespaceContext
in interfaceXPathEngine
- Parameters:
prefix2Uri
- maps from prefix to namespace URI.
-