title: How can I add a body element to an empty DOM document?
body: <p>I have this string that represents the body of a page, which I would like to parse for some elements. I believe (feel free to contradict me) the best way to do so is to create an empty document, then add the body and use standard JS methods to get what I want.<br>
  But I don't seem to be able to add the body to the document. In chrome, the following code fails on line 2 with <code>NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7</code>.</p>
  
  <pre><code> var dom = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null);
   dom.firstChild.innerHTML = "&lt;body&gt;&lt;p&gt;Hello world&lt;/p&gt;&lt;/body&gt;";
  </code></pre>
  
  <p>Is there any way to achieve what I want?</p>