title: How to add attribute to xml header using SimpleXMLElement
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/869650/getting-simplexmlelement-to-include-the-encoding-in-output">Getting SimpleXMLElement to include the encoding in output</a>  </p>
  </blockquote>
  
  
  
  <p><strong>PHP :</strong>   </p>
  
  <pre><code>$xml = new SimpleXMLElement("&lt;Title0&gt;&lt;/Title0&gt;");
  $xml-&gt;Title1='Some Text  1';
  $output = $xml-&gt;asXML('mak.xml');
  </code></pre>
  
  <p><strong>XML Output :</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;  
  &lt;Title0&gt;
      &lt;Title1&gt;Some Text 1&lt;/Title1&gt;
  &lt;/Title0&gt;
  </code></pre>
  
  <p>But I want to add attrbute like <code>encoding="utf-8"</code> to xml header , so that I can have something like this :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;  
  &lt;Title0&gt;
      &lt;Title1&gt;Some Text 1&lt;/Title1&gt;
  &lt;/Title0&gt;
  </code></pre>
  
  <p>I dont want to use find and replace sort of things on the output file.</p>