I have a xml that looks like this
<ArticleId keyId="3d5c0332:1533c106ef9:67eb" price="6495,00" primId="HP229141500">
<StockQuant storeId="72">1.0</StockQuant>
<StockQuant storeId="Utstilling">1.0</StockQuant>
<PosterName></PosterName>
<PosterDescription></PosterDescription>
<Dimension></Dimension>
<Assembled></Assembled>
<AssemblyPrice></AssemblyPrice>
</ArticleId>
I load this from a file that contais many ArticleId-elements using simplexml_load_file().
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.
I iterate through the elements like this:
foreach( $xml as $key => $value )
{
foreach( $value->StockQuant as $key2 => $value2 )
{
$stocks = simplexml_import_dom($value2);
print_r($stocks);
}
}
*Edit to add the foreach loop.