title: PHP SimpleXML nodes same level
body: <p>I have a xml that looks like this</p>
  
  <pre><code>&lt;ArticleId keyId="3d5c0332:1533c106ef9:67eb" price="6495,00" primId="HP229141500"&gt;
  &lt;StockQuant storeId="72"&gt;1.0&lt;/StockQuant&gt;
  &lt;StockQuant storeId="Utstilling"&gt;1.0&lt;/StockQuant&gt;
  &lt;PosterName&gt;&lt;/PosterName&gt;
  &lt;PosterDescription&gt;&lt;/PosterDescription&gt;
  &lt;Dimension&gt;&lt;/Dimension&gt;
  &lt;Assembled&gt;&lt;/Assembled&gt;
  &lt;AssemblyPrice&gt;&lt;/AssemblyPrice&gt;
  &lt;/ArticleId&gt;
  </code></pre>
  
  <p>I load this from a file that contais many ArticleId-elements using simplexml_load_file(). </p>
  
  <p>The problem is that I don't get all of the info for StockQuant. If I print_r the xml, then I get the data; 1.0, but I don't get the attributes; storeId="72". If I do it like the example belove, then I only get 1 StockQuant element, not both. </p>
  
  <p>I iterate through the elements like this:</p>
  
  <pre><code>foreach( $xml as $key =&gt; $value )
  {
      foreach( $value-&gt;StockQuant as $key2 =&gt; $value2 )
      {
          $stocks = simplexml_import_dom($value2);
          print_r($stocks);
      }
  }
  </code></pre>
  
  <p>*Edit to add the foreach loop.</p>