Class PathMatcher

  • Direct Known Subclasses:
    FieldMatcher, SelectorMatcher

    public abstract class PathMatcher
    extends Matcher
    Base implementation of XPath matching engine. It only supports the subset defined in XML Schema Part 1. Extra care must be taken to call the testInitialMatch method after the creation of an object. Match to an attribute is not supported. It is implemented in FieldPathMatcher class. The onMatched method is called when the specified XPath matches the current element. Derived classes should implement this method to do something useful.
    Author:
    Kohsuke KAWAGUCHI
    • Field Detail

      • children

        protected Matcher[] children
        child matchers.
    • Method Detail

      • start

        protected void start​(String namespaceURI,
                             String localName)
                      throws SAXException
        this method should be called immediately after the installment of this PathMatcher.
        Throws:
        SAXException
      • onElementMatched

        protected abstract void onElementMatched​(String namespaceURI,
                                                 String localName)
                                          throws SAXException
        this method is called when the element matches the XPath.
        Throws:
        SAXException
      • onAttributeMatched

        protected abstract void onAttributeMatched​(String namespaceURI,
                                                   String localName,
                                                   String value,
                                                   org.relaxng.datatype.Datatype type)
                                            throws SAXException
        this method is called when the attribute matches the XPath.
        Throws:
        SAXException
      • getDepth

        protected final int getDepth()
      • onRemoved

        protected void onRemoved()
                          throws SAXException
        called when this bundle is deactivated. This method is called by the endElement method when this bundle is removed. A derived class can override this method to do whatever necessary.
        Throws:
        SAXException