Class XPathPattern

  • All Implemented Interfaces:
    NodeFilter, Pattern

    public class XPathPattern
    extends Object
    implements Pattern

    XPathPattern is an implementation of Pattern which uses an XPath xpath.

    • Constructor Detail

      • XPathPattern

        public XPathPattern​(org.jaxen.pattern.Pattern pattern)
      • XPathPattern

        public XPathPattern​(String text)
    • Method Detail

      • matches

        public boolean matches​(Node node)
        Description copied from interface: Pattern
        DOCUMENT ME!
        Specified by:
        matches in interface NodeFilter
        Specified by:
        matches in interface Pattern
        Parameters:
        node - DOCUMENT ME!
        Returns:
        true if the pattern matches the given DOM4J node.
      • getText

        public String getText()
      • getUnionPatterns

        public Pattern[] getUnionPatterns()
        Description copied from interface: Pattern
        If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern. Otherwise this method should return null.
        Specified by:
        getUnionPatterns in interface Pattern
        Returns:
        an array of the patterns which make up this union pattern or null if this pattern is not a union pattern
      • getMatchType

        public short getMatchType()
        Description copied from interface: Pattern
        DOCUMENT ME!
        Specified by:
        getMatchType in interface Pattern
        Returns:
        the type of node the pattern matches which by default should return ANY_NODE if it can match any kind of node.
      • getMatchesNodeName

        public String getMatchesNodeName()
        Description copied from interface: Pattern
        For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches. This allows a more efficient rule matching algorithm to be performed, rather than a brute force approach of evaluating every pattern for a given Node.
        Specified by:
        getMatchesNodeName in interface Pattern
        Returns:
        the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.
      • setVariableContext

        public void setVariableContext​(org.jaxen.VariableContext variableContext)
      • getContextSupport

        protected org.jaxen.ContextSupport getContextSupport()
      • handleJaxenException

        protected void handleJaxenException​(org.jaxen.JaxenException exception)
                                     throws XPathException
        Throws:
        XPathException