title: How do I insert HTML into a PHP DOM object?
body: <p>I am using PHP's DOM object to create HTML pages for my website. This works great for my head, however since I will be entering a lot of HTML into the body (not via DOM), I would think I would need to use <code>DOM-&gt;createElement($bodyHTML)</code> to add my HTML from my site to the DOM object. </p>
  
  <p>However <code>DOM-&gt;createElement</code> seems to parse all HTML entities so my end result ended up displaying the HTML on the page and not the actual renders HTML.</p>
  
  <p>I am currently using a hack to get this to work, </p>
  
  <pre><code>$body = $this-&gt;DOM
               -&gt;createComment('DOM Glitch--&gt;&lt;body&gt;'.$bodyHTML."&lt;/body&gt;&lt;!--Woot");
  </code></pre>
  
  <p>Which puts all my site code in a comment, which I bypass athe comment and manually add the <code>&lt;body&gt;</code> tags.</p>
  
  <p>Currently this method works, but I believe there should be a more proper way of doing this. Ideally something like <code>DOM-&gt;createElement()</code> that will not parse any of the string.</p>
  
  <p>I also tried using <code>DOM-&gt;createDocumentFragment()</code> However it does not like some of the string so it would error and not work (Along with take up extra CPU power to re-parse the body's HTML).</p>
  
  <p>So, my question is, is there a better way of doing this other than using <code>DOM-&gt;createComment()</code>?</p>