@Override
    public void endDocument(ContentHandler contentHandler, Metadata metadata) throws SAXException {
        super.endDocument(contentHandler, metadata);
        addContent(contentHandler, metadata);
        try {
            metadataFilter.filter(metadata);
        } catch (TikaException e) {
            throw new SAXException(e);
        }
        if (metadata.size() > 0) {
            metadataList.add(0, ParserUtils.cloneMetadata(metadata));
        }
        writeFinalEmbeddedPaths();
    }
@param contentHandler content handler used on the main document
@param metadata       metadata from the main document
@throws SAXException
tika-core/src/main/java/org/apache/tika/sax/RecursiveParserWrapperHandler.java