JackTheJack
JackTheJack

Reputation: 187

SimpleXML Xpath

XML file can be seen below:

#

How can I code it so the product and offer data is displayed in order.

Currently i have tried the following code:

foreach ($xml->GeneralSearchResponse->categories->category->items->xpath('/product | /offer') as $product) 
{

    print $product->name;
}

This however does not show any data.

Thanks,

Jack

Upvotes: 0

Views: 344

Answers (1)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243449

The XML pointed to by the provided link is not well-formed. Most probably you get an XML parsing error.

More specifically, any &somename= must be changed to &somename=.

There also seem to be other severe, illegal syntax problems.

Upvotes: 1

Related Questions