@Override
    public void endDocument() throws SAXException {
        lazyEndHead(useFrameset);

        if (useFrameset) {
            super.endElement(XHTML, "frameset", "frameset");
        } else {
            super.endElement(XHTML, "body", "body");
        }

        super.endElement(XHTML, "html", "html");

        endPrefixMapping("");
        super.endDocument();
    }
Ends the XHTML document by writing the following footer and
clearing the namespace mappings:
<pre>
  &lt;/body&gt;
&lt;/html&gt;
</pre>
tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java