Package org.xmlunit.xpath
Class JAXPXPathEngine
- java.lang.Object
-
- org.xmlunit.xpath.JAXPXPathEngine
-
- All Implemented Interfaces:
XPathEngine
public class JAXPXPathEngine extends java.lang.Object implements XPathEngine
Simplified access to JAXP's XPath API.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.xml.xpath.XPath
xpath
-
Constructor Summary
Constructors Constructor Description JAXPXPathEngine()
Create an XPathEngine that uses JAXP's default XPathFactory under the covers.JAXPXPathEngine(javax.xml.xpath.XPathFactory fac)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
evaluate(java.lang.String xPath, javax.xml.transform.Source s)
Evaluates an XPath expression and stringifies the result.java.lang.String
evaluate(java.lang.String xPath, org.w3c.dom.Node n)
Evaluates an XPath expression and stringifies the result.java.lang.Iterable<org.w3c.dom.Node>
selectNodes(java.lang.String xPath, javax.xml.transform.Source s)
Returns a potentially empty collection of Nodes matching an XPath expression.java.lang.Iterable<org.w3c.dom.Node>
selectNodes(java.lang.String xPath, org.w3c.dom.Node n)
Returns a potentially empty collection of Nodes matching an XPath expression.void
setNamespaceContext(java.util.Map<java.lang.String,java.lang.String> prefix2Uri)
Establish a namespace context.
-
-
-
Method Detail
-
selectNodes
public java.lang.Iterable<org.w3c.dom.Node> selectNodes(java.lang.String xPath, javax.xml.transform.Source s)
Returns a potentially empty collection of Nodes matching an XPath expression.- Specified by:
selectNodes
in interfaceXPathEngine
-
evaluate
public java.lang.String evaluate(java.lang.String xPath, javax.xml.transform.Source s)
Evaluates an XPath expression and stringifies the result.- Specified by:
evaluate
in interfaceXPathEngine
-
selectNodes
public java.lang.Iterable<org.w3c.dom.Node> selectNodes(java.lang.String xPath, org.w3c.dom.Node n)
Returns a potentially empty collection of Nodes matching an XPath expression.- Specified by:
selectNodes
in interfaceXPathEngine
-
evaluate
public java.lang.String evaluate(java.lang.String xPath, org.w3c.dom.Node n)
Evaluates an XPath expression and stringifies the result.- Specified by:
evaluate
in interfaceXPathEngine
-
setNamespaceContext
public void setNamespaceContext(java.util.Map<java.lang.String,java.lang.String> prefix2Uri)
Establish a namespace context.- Specified by:
setNamespaceContext
in interfaceXPathEngine
- Parameters:
prefix2Uri
- maps from prefix to namespace URI.
-
-