public void startEmbeddedDocument(ContentHandler contentHandler, Metadata metadata)
            throws SAXException {
        embeddedResources++;
        embeddedDepth++;
        if (embeddedDepth >= MAX_DEPTH) {
            throw new SAXException("Max embedded depth reached: " + embeddedDepth);
        }
        metadata.set(TikaCoreProperties.EMBEDDED_DEPTH, embeddedDepth);
    }
This is called before parsing each embedded document.  Override this
for custom behavior.  Make sure to call this in your custom classes
because this tracks the number of embedded documents.

@param contentHandler local handler to be used on this embedded document
@param metadata       embedded document's metadata
tika-core/src/main/java/org/apache/tika/sax/AbstractRecursiveParserWrapperHandler.java