Oh, I see now where this problem with <meta/> elements is coming from.
One reasonably clean way to solve this would be to disable the output of <meta/> elements from HtmlHandler while keeping the code that sets the respective Metadata entries. Then in XHTMLContentHandler we'd modify the lazyStartDocument() method to output not just the <title/> element but the full set of collected metadata as <meta/> elements. We could also set the lang attribute (or xml:lang?) of the <html/> element if the respective Metadata entry is set.
The nice thing about this solution would be that the inclusion of metadata in <head/> would work also for other document types beyond HTML.