Interface XPathEngine

All Known Implementing Classes:
JAXPXPathEngine

public interface XPathEngine
Interface for XMLUnit's XPath abstraction.
  • Method Details

    • selectNodes

      Iterable<Node> selectNodes(String xPath, Source s)
      Returns a potentially empty collection of Nodes matching an XPath expression.
      Parameters:
      xPath - the XPath expression
      s - the XML source to apply the expression to
      Returns:
      matching nodes
    • evaluate

      String evaluate(String xPath, Source s)
      Evaluates an XPath expression and stringifies the result.
      Parameters:
      xPath - the XPath expression
      s - the XML source to apply the expression to
      Returns:
      stringified result
    • selectNodes

      Iterable<Node> selectNodes(String xPath, Node n)
      Returns a potentially empty collection of Nodes matching an XPath expression.
      Parameters:
      xPath - the XPath expression
      n - the XML source to apply the expression to
      Returns:
      matching nodes
    • evaluate

      String evaluate(String xPath, Node n)
      Evaluates an XPath expression and stringifies the result.
      Parameters:
      xPath - the XPath expression
      n - the XML source to apply the expression to
      Returns:
      stringified result
    • setNamespaceContext

      void setNamespaceContext(Map<String,String> prefix2Uri)
      Establish a namespace context.
      Parameters:
      prefix2Uri - maps from prefix to namespace URI.