title: Remove parent element, keep all inner children in DOMDocument with saveHTML
body: <p>I'm manipulating a short HTML snippet with XPath; when I output the changed snippet back with $doc->saveHTML(), <code>DOCTYPE</code> gets added, and <code>HTML / BODY</code> tags wrap the output. I want to remove those, but keep all the children inside by only using the DOMDocument functions.  For example:</p>
  
  <pre><code>$doc = new DOMDocument();
  $doc-&gt;loadHTML('&lt;p&gt;&lt;strong&gt;Title...&lt;/strong&gt;&lt;/p&gt;
  &lt;a href="http://www....."&gt;&lt;img src="http://" alt=""&gt;&lt;/a&gt;
  &lt;p&gt;...to be one of those crowning achievements...&lt;/p&gt;');
  // manipulation goes here
  echo htmlentities( $doc-&gt;saveHTML() );
  </code></pre>
  
  <p>This produces:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ...&gt;
  &lt;html&gt;&lt;body&gt;
  &lt;p&gt;&lt;strong&gt;Title...&lt;/strong&gt;&lt;/p&gt;
  &lt;a href="http://www....."&gt;&lt;img src="http://" alt=""&gt;&lt;/a&gt;
  &lt;p&gt;...to be one of those crowning achievements...&lt;/p&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>I've attempted some of the simple tricks, such as:</p>
  
  <pre><code># removes doctype
  $doc-&gt;removeChild($doc-&gt;firstChild);
  
  # &lt;body&gt; replaces &lt;html&gt;
  $doc-&gt;replaceChild($doc-&gt;firstChild-&gt;firstChild, $doc-&gt;firstChild); 
  </code></pre>
  
  <p>So far that only removes DOCTYPE and replaces HTML with BODY.  However, what remains is body > variable number of elements at this point.</p>
  
  <p>How do I remove the <code>&lt;body&gt;</code> tag but keep <strong>all</strong> of its children, given that they will be structured variably, in a neat - clean way with PHP's DOM manipulation?</p>