title: How can I build an HTML org.w3c.dom.Document?
body: <p>The <a href="http://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Document.html" rel="noreferrer">documentation of the <code>Document</code> interface</a> describes the interface as:</p>
  
  <blockquote>
    <p>The Document interface represents the entire HTML or XML document. </p>
  </blockquote>
  
  <p><code>javax.xml.parsers.DocumentBuilder</code> builds XML <code>Document</code>s.  However, I am unable to find a way to build a <code>Document</code> that is an HTML <code>Document</code>! </p>
  
  <p>I want an HTML <code>Document</code> because I am trying to build a document that I then pass to a library that is expecting an HTML <code>Document</code>. This library uses <code>Document#getElementsByTagName(String tagname)</code> in a non case-sensitive manner, which is fine for HTML, but not for XML.</p>
  
  <p>I've looked around, and am not finding anything. Items like <a href="https://stackoverflow.com/questions/2297924/how-to-convert-an-html-source-of-a-webpage-into-org-w3c-dom-document-in-java">How to convert an Html source of a webpage into org.w3c.dom.Document in java?</a> don't actually have an answer.</p>