public void endDocument(ContentHandler contentHandler, Metadata metadata) throws SAXException {
        if (hasHitMaximumEmbeddedResources()) {
            metadata.set(EMBEDDED_RESOURCE_LIMIT_REACHED, "true");
        }
        metadata.set(TikaCoreProperties.EMBEDDED_DEPTH, 0);
    }
This is called after the full parse has completed.  Override this
for custom behavior.  Make sure to call this as <code>super.endDocument(...)</code>
in subclasses because this adds whether or not the embedded resource
maximum has been hit to the metadata.

@param contentHandler content handler that was used on the main document
@param metadata       metadata that was gathered for the main document
@throws SAXException
tika-core/src/main/java/org/apache/tika/sax/AbstractRecursiveParserWrapperHandler.java