title: How to create and set values for attribute in XML?
body: <p>How to create and set values for attribute in XML ? I need to set ateam id="101" ?
  With this I listed my code. By using createAttribute i created but i dont know how to set value for that attribute..</p>
  
  <pre><code>/* create XML Content */
   $domtree = new DOMDocument('1.0', 'UTF-8');
   $xmlRoot = $domtree-&gt;createElement("xml");
   $xmlRoot = $domtree-&gt;appendChild($xmlRoot);
   $currentTrack = $domtree-&gt;createElement("messsage");
   $currentTrack = $xmlRoot-&gt;appendChild($currentTrack);
   $currentTrack-&gt;appendChild($domtree-&gt;createElement('category','Scores'));
   $Game = $currentTrack-&gt;appendChild($domtree-&gt;createElement('Game',''));
   $Game-&gt;appendChild($v = $domtree-&gt;createElement('ateam','India'));
   $Game-&gt;appendChild($domtree-&gt;createElement('score',30));
   $v-&gt;appendChild($domtree-&gt;createAttribute('id'));
    echo $domtree-&gt;saveXML();
  </code></pre>
  
  <p><strong>OUTPUT</strong> </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xml&gt;
      &lt;messsage&gt;
          &lt;category&gt;Scores&lt;/category&gt;
          &lt;Game&gt;
              &lt;ateam id=""&gt;India&lt;/ateam&gt;
              &lt;score&gt;30&lt;/score&gt;
          &lt;/Game&gt;
      &lt;/messsage&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p><strong>Expected OUTPUT</strong></p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;xml&gt;
          &lt;messsage&gt;
              &lt;category&gt;Scores&lt;/category&gt;
              &lt;Game&gt;
                  &lt;ateam id="101"&gt;India&lt;/ateam&gt;
                  &lt;score&gt;30&lt;/score&gt;
              &lt;/Game&gt;
          &lt;/messsage&gt;
      &lt;/xml&gt;
  </code></pre>