title: php echo xml documents with header
body: <p>php code </p>
  
  <pre><code>&lt;?php
  $xml="&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;";
  $xml.="&lt;db_entry id=\"$model-&gt;id\" doi=\"$model-&gt;identifier\"&gt;";
  $xml.="&lt;dataset&gt;";
  $xml.="&lt;/dataset&gt;";
  $xml.="&lt;/db_entry&gt;";
  $xml=preg_replace('/&amp;(?!#?[a-z0-9]+;)/', '&amp;amp;', $xml);
  $output= simplexml_load_string($xml);
  echo $output-&gt;asXML();
  </code></pre>
  
  <p>when i run it, it can't shows the xml format in the webpage(shows all text without xml tag).
  so i add the header(), but it shows XML Parsing Error: XML or text declaration not at start of entity.</p>
  
  <pre><code>&lt;?php header("Content-type: text/xml"); ?&gt;
  &lt;?php
      $xml="&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;";
      $xml.="&lt;db_entry id=\"$model-&gt;id\" doi=\"$model-&gt;identifier\"&gt;";
      $xml.="&lt;dataset&gt;";
      $xml.="&lt;/dataset&gt;";
      $xml.="&lt;/db_entry&gt;";
      $xml=preg_replace('/&amp;(?!#?[a-z0-9]+;)/', '&amp;amp;', $xml);
      $output= simplexml_load_string($xml);
      echo $output-&gt;asXML();
  </code></pre>
  
  <p>the webpage shows empty, but in the page view source it shows</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;db_entry id="5" doi="110039"&gt;&lt;dataset/&gt;&lt;/db_entry&gt;
  </code></pre>
  
  <p>and has three blank lines at the beginning. </p>