php DomDocument XPath moves empty values to bottom

minniebat

New Member
I'm trying to scan an XML file with PHP using DomDocument and XPath. The XML file consists of products. Some products don't have images so the image tag is skipped in the xml (not written at all).There are 1192 products in the feed and 1105 images, and when I use a \[code\]for\[/code\] loop to find the missing images.I expect to get \[code\]Notice: Trying to get property of non-object\[/code\]). Instead, at first I get ALL the images and then the empty positions.I imagine there is a parameter that I need to pass on DomDocument but I can't figure which one. It automatically adds all the elements with value on top of array, and it results in adding wrong data to the database tables.
 
Back
Top