title: XML Obtaining Namespaced node values
body: <p>I have this xml fragment:</p>
  
  <pre><code>&lt;ModelList&gt;
                 &lt;ProductModel&gt;
                    &lt;CategoryCode&gt;06&lt;/CategoryCode&gt;
                    &lt;Definition&gt;
                       &lt;ListProperties xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;
                          &lt;a:KeyValueOfstringArrayOfstringty7Ep6D1&gt;
                             &lt;a:Key&gt;Couleur principale&lt;/a:Key&gt;
                             &lt;a:Value&gt;
                                &lt;a:string&gt;Blanc&lt;/a:string&gt;
                                &lt;a:string&gt;Noir&lt;/a:string&gt;
                                &lt;a:string&gt;Gris&lt;/a:string&gt;
                                &lt;a:string&gt;Inox&lt;/a:string&gt;
                                &lt;a:string&gt;Rose&lt;/a:string&gt;
  </code></pre>
  
  <p>That I am attempting to parse (with simplexml) with this:</p>
  
  <pre><code>$xml-&gt;registerXPathNamespace('a', 'http://schemas.microsoft.com/2003/10/Serialization/Arrays');
  
          $x = $xml-&gt;xpath('//a:KeyValueOfstringArrayOfstringty7Ep6D1');
          //var_dump($x);
  
  
          foreach($x as $k =&gt; $model) {
              $key = (string)$model-&gt;Key;
              var_dump($model-&gt;Key);
          }
  </code></pre>
  
  <p>That var dump currently returns a whole bunch of </p>
  
  <pre><code>object(SimpleXMLElement)[7823]
  </code></pre>
  
  <p>Which appears to contain the a:Value block. So how do I get the value of the node, not the blasted object tree?</p>
  
  <p>And people think xml is easily parsed.</p>