public void endElement(String uri, String localName, String name) throws SAXException {
        if (matcher.matchesElement()) {
            super.endElement(uri, localName, name);
        }
        // this was originally added for tagsoup, but we need it generally
        if (!matchers.isEmpty()) {
            matcher = matchers.removeFirst();
        }
    }
Content handler decorator that only passes the elements, attributes,
and text nodes that match the given XPath expression.
tika-core/src/main/java/org/apache/tika/sax/xpath/MatchingContentHandler.java