private void lazyStartHead() throws SAXException {
        if (!headStarted) {
            headStarted = true;

            // Call directly, so we don't go through our startElement(), which will
            // ignore these elements.
            AttributesImpl htmlAttrs = new AttributesImpl();
            String lang = metadata.get(Metadata.CONTENT_LANGUAGE);
            if (lang != null) {
                htmlAttrs.addAttribute("", "lang", "lang", "CDATA", lang);
            }
            super.startElement(XHTML, "html", "html", htmlAttrs);
            newline();
            super.startElement(XHTML, "head", "head", EMPTY_ATTRIBUTES);
            newline();
        }
    }
Generates the following XHTML prefix when called for the first time:
<pre>
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;...&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
</pre>
tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java