I am stock with this XML problem, I have a XML file that I browse to find values. Everything is working fine, I can read on all the child nodes, but I am stuck on this section. The XML portion containing photos are all the same name of the node, except for an attribute, how can I specify how to browse according to this and take the filename value of each of them
XML
...
<Engine>
<Fuel>Unleaded</Fuel>
<Cylinders>4</Cylinders>
<Induction>Normally aspirated</Induction>
</Engine>
<Photo order="1">
<Filename>http://usedcarpics.s3.amazonaws.com/514SPINELLITOYOTA2/b5092588_2.jpg</Filename>
</Photo>
<Photo order="2">
<Filename>http://usedcarpics.s3.amazonaws.com/514SPINELLITOYOTA2/b5092588_3.jpg</Filename>
</Photo>
<Photo order="3">
<Filename>http://usedcarpics.s3.amazonaws.com/514SPINELLITOYOTA2/b5092588_4.jpg</Filename>
</Photo>
<Photo order="4">
<Filename>http://usedcarpics.s3.amazonaws.com/514SPINELLITOYOTA2/b5092588_5.jpg</Filename>
</Photo>
<Photo order="5">
<Filename>http://usedcarpics.s3.amazonaws.com/514SPINELLITOYOTA2/b5092588_6.jpg</Filename>
...
In my php file, I have this code that help me find the values:
$import->stock_no =(string)$item->Invoice->Vehicle->VehicleStock;
$import->image1 =(string)$item->Invoice->Vehicle->Photo->attributes(order="1")->Filename;
Of course it doesn't work, how can I browse all the photo nodes( I have 8 pictures I need to take the values from)
I want to have $import->image1 = (filename in the attibutes of pohoto 1), sames for image 2, 3, etc.
Thank you.