Class XPathMatcher

    • Constructor Detail

      • XPathMatcher

        public XPathMatcher​(String xpathExpression)
        Constructor of XPath Matcher with a XPath expression.
        Parameters:
        xpathExpression -
    • Method Detail

      • match

        public boolean match​(Node node)
        Returns true if the given DOM Node match the XPath expression of this XPath matcher and false otherwise.
        Parameters:
        node - the DOM Node to match.
        Returns:
        true if the given DOM Node match the XPath expression of this XPath matcher and false otherwise.
      • match

        public boolean match​(Node node,
                             Collection<String> wildcardValues)
        Returns true if the given DOM Node match the XPath expression of this XPath matcher and false otherwise. This method use wilcard values if XPath expression contains wildcard (like [@id='$0'].
        Parameters:
        node - the DOM Node to match.
        wildcardValues - the list of wildcard values and null otherwise.
        Returns:
      • getWildcardValues

        public List<String> getWildcardValues​(Node selectedNode)
        Returns list of wildcard values of the given DOM Node.
        Parameters:
        selectedNode -
        Returns:
      • getNbWildCard

        public int getNbWildCard()
        Returns the number of wilcard used in the XPath expression and -1 if there is no wildcard.
        Returns:
      • createAnyElementMatcher

        protected XPathElementMatcher createAnyElementMatcher()
        Create XPath any element matcher.
        Returns:
        the XPath any element matcher.
      • createAttributeMatcher

        protected XPathAttributeMatcher createAttributeMatcher​(XPathElementMatcher elementmatcher,
                                                               String attrName,
                                                               String attrValue)
        Create the XPath attribute matcher.
        Parameters:
        elementmatcher - the parent element matcher.
        attrName - the attribute name to match.
        attrValue - the attribute value to match.
        Returns:
        the XPath attribute matcher.
      • getNodeSelectorType

        public IXPathNodeMatcher.MatcherType getNodeSelectorType()
        Returns the type (element, attribute, text) of the node to select.
        Returns:
        the type (element, attribute, text) of the node to select.o