I've got some XML that looks a bit like this:
<item code="1">
<description>This is an item.</description>
<prices>
<price nett="1.50"/>
<price code="RPP" nett="20.33" />
</prices>
</item>
And I'm trying to import it into our DB using PHP like this:
$xmlurl = 'thexmlfile.xml';
$dom = new DOMDocument();
$dom->load($xmlurl);
$records = $dom->getElementsByTagName('item');
foreach($records as $record) {
$descs = $record-> getElementsByTagName('description');
$desc = $descs->item(0)->nodeValue;
echo $desc . '<br />';
}
That works fine. It pulls the description. However, how do I get the item code and the prices section? Loop within a loop?]
Thank you