title: Unable to add Attribute with Namespace Prefix using PHP Simplexml
body: <p>Trying to edit an XML document that uses Excels XML-Namespaces:</p>
  
  <pre><code>&lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
            xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"&gt;
  </code></pre>
  
  <p>I need to get to this result (need the <strong>ss:</strong> prefix befire <strong>Type</strong>):</p>
  
  <pre><code>&lt;Cell ...&gt;&lt;Data ss:Type="String"&gt;value&lt;/Data&gt;&lt;/Cell&gt;
  </code></pre>
  
  <p>I've looked over the question <a href="https://stackoverflow.com/questions/1592665/unable-add-namespace-with-phps-simplexml"><em>Unable add namespace with PHPs SimpleXML</em></a> but this method is not helping here. In other words, running this as outlined there</p>
  
  <pre><code>$data = $cells[$i]-&gt;addChild('Data','value'); 
  $data-&gt;addAttribute("ss:Type","String","urn:schemas-microsoft-com:office:spreadsheet");
  </code></pre>
  
  <p>gives me</p>
  
  <pre><code>&lt;Cell ...&gt;&lt;Data Type="String"&gt;value&lt;/Data&gt;&lt;/Cell&gt;
  </code></pre>
  
  <p>without the <strong>ss:</strong> prefix. And if I remove the <strong>urn:</strong> prefix, then I'm getting this</p>
  
  <pre><code>&lt;Cell ...&gt;&lt;Data xmlns:ss="schemas-microsoft-com:office:spreadsheet" ss:Type="String"&gt;value&lt;/Data&gt;&lt;/Cell&gt;
  </code></pre>
  
  <p>In either case, when I open the document with Excel, the data is invisible.  With <strong>urn:</strong> the <strong>ss:</strong> is missing and without <strong>urn:</strong> the definition becomes part of the <strong></strong> element which is not working in Excel.</p>