title: PHP's SimpleXML: How to use colons in names
body: <p>I am trying to generate an RSS Google Merchant, using SimpleXML.</p>
  
  <p>The sample given by Google is:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;rss version="2.0" 
  xmlns:g="http://base.google.com/ns/1.0"&gt;
  &lt;channel&gt;
  &lt;title&gt;The name of your data feed&lt;/title&gt;
  &lt;link&gt;http://www.example.com&lt;/link&gt;
  &lt;description&gt;A description of your content&lt;/description&gt;
  &lt;item&gt;
  &lt;title&gt;Red wool sweater&lt;/title&gt;
  &lt;link&gt; http://www.example.com/item1-info-page.html&lt;/link&gt;
  &lt;description&gt;Comfortable and soft, this sweater will keep you warm on those cold winter nights.&lt;/description&gt;
  &lt;g:image_link&gt;http://www.example.com/image1.jpg&lt;/g:image_link&gt; &lt;g:price&gt;25&lt;/g:price&gt; &lt;g:condition&gt;new&lt;/g:condition&gt; &lt;g:id&gt;1a&lt;/g:id&gt;
  &lt;/item&gt;
  &lt;/channel&gt;
  &lt;/rss&gt;
  </code></pre>
  
  <p>My code has things like:</p>
  
  <pre><code>$product-&gt;addChild("g:condition", 'new');
  </code></pre>
  
  <p>Which generates:</p>
  
  <pre><code>&lt;condition&gt;new&lt;/condition&gt;
  </code></pre>
  
  <p>I read online that I should instead use:</p>
  
  <pre><code>$product-&gt;addChild("g:condition", 'new', 'http://base.google.com/ns/1.0');
  </code></pre>
  
  <p>Which now generates:</p>
  
  <pre><code>&lt;g:condition xmlns:g="http://base.google.com/ns/1.0"&gt;new&lt;/g:condition&gt;
  </code></pre>
  
  <p>This seems very counter-intuitive to me, as now the "xmlns" declaration is on almost EVERY line of my RSS feed intead of just once in the root element.</p>
  
  <p>Am I missing something?</p>