title: Adding Nodes to Existing XML
body: <p>The problem i was having is the Root XML was being produced every time it writes to the XML. 
  The Main issue was setting up Child and Defining the Root. From the help of Łza
  I now understand the Root XML Node is ignored. 
  So then you setup and create a Child and then add your content, And example of the correct format is. </p>
  
  <pre><code>$xml = simplexml_load_file('FILENAME.xml');  // Load XML File Need to add IF Statment to create if does not exist
  
  $result = $xml-&gt;addchild('Result'); // Ignore Root NODE and Add Child Results
  
  $result-&gt;addChild('Time', gmdate('D-M-Y -H:i:s')); // Rest of the below adds Child to Result and outputs results
  $result-&gt;addChild('Channel', $Site);
  $result-&gt;addChild('Type', '**');
  $result-&gt;addChild('Process', $Status);
  $result-&gt;addChild('SKU', $code-&gt;SKU);
  $result-&gt;addChild('item', $item);
  $result-&gt;addChild('Status', '$Feedback');
  $result-&gt;addChild('ErrorID', '$Error');
  $result-&gt;addChild('Message', '$Message');
  
  $xml-&gt;asXml('FILENAME.xml');  //Write to file would be
  
  // All of the above Code is using variables from another part of the script
  </code></pre>
  
  <p>The output would be</p>
  
  <pre><code>&lt;Root&gt;
      &lt;Result&gt;
          &lt;Time&gt;Fri-May-2013 -09:15:22&lt;/Time&gt;
          &lt;Channel&gt;20&lt;/Channel&gt;
          &lt;Type&gt;**&lt;/Type&gt;
          &lt;Process&gt;Update&lt;/Process&gt;
          &lt;SKU&gt;98746524765&lt;/SKU&gt;
          &lt;Item/&gt;
          &lt;Status&gt;Problem&lt;/Status&gt;
          &lt;ErrorID&gt;999-Error&lt;/ErrorID&gt;
          &lt;Message&gt;Unknown file format support&lt;/Message&gt;
      &lt;/Result&gt;
      &lt;Result&gt;
          &lt;Time&gt;Fri-May-2013 -09:15:22&lt;/Time&gt;
          &lt;Channel&gt;20&lt;/Channel&gt;
          &lt;Type&gt;**&lt;/Type&gt;
          &lt;Process&gt;Update&lt;/Process&gt;
          &lt;SKU&gt;5412254785&lt;/SKU&gt;
          &lt;Item/&gt;
          &lt;Status&gt;Problem&lt;/Status&gt;
          &lt;ErrorID&gt;123-Error&lt;/ErrorID&gt;
          &lt;Message&gt;Invalid Item&lt;/Message&gt;
      &lt;/Result&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>Thanks</p>