title: Problems with creating XML with DOMDocument in PHP
body: <p>The below code is fetched from php.net (<a href="http://docs.php.net/manual/en/domdocument.savexml.php" rel="nofollow noreferrer">http://docs.php.net/manual/en/domdocument.savexml.php</a>). My problem is - it doesn't work. My only output from this is: "Saving all the document:  Saving only the title part:". What am I missing here?</p>
  
  <pre><code>$doc = new DOMDocument('1.0');
    // we want a nice output  
    $doc-&gt;formatOutput = true;   
    $root = $doc-&gt;createElement('book');
    $root = $doc-&gt;appendChild($root);  
    $title = $doc-&gt;createElement('title');  
    $title = $root-&gt;appendChild($title);
    $text = $doc-&gt;createTextNode('This is the title');  
    $text = $title-&gt;appendChild($text); 
    echo "Saving all the document:\n";  
    echo $doc-&gt;saveXML() . "\n";
    echo "Saving only the title part:\n";  
    echo $doc-&gt;saveXML($title);
  </code></pre>