![Picture of mundaka Picture of mundaka](/graphics/unknown.gif)
mundaka - 2009-10-16 08:41:01
Hi there
First of all, thanks you for the nice class.
I've this xml:
<products>
<product>
<ref>001</ref>
<name>First</name>
</product>
<product>
<ref>002</ref>
<name>Second</name>
</product>
</products>
And I am doing this:
//#################################
$sxml = new simplexml;
$sxml->ignore_level = 1;
$data = $sxml->xml_load_file($file);
echo $data->product->ref;
//#################################
And it works perfectly, but I need to loop all the product nodes, so I am trying this with no luck:
foreach($data->product as $item){
echo $item->ref;
}
How can access each node?
Thanks!