Reputation: 1296
I am trying to implement the Expedia API and I have run into an issue. I need to get the description tag of a parent tag with a certain attribute number. This is what I have tried and it is not working:
$data->RoomTypes->RoomType['roomCode="17918"']->description;
I do not know if this is the right syntax. If I were going to look for it in mysql it would look something like this:
mysql_query("SELECT description FROM RoomType WHERE roomCode = '17918'");
How would I go about doing this in xml with php?? Any help would be greatly appreciated!! Thank you in advance!
Upvotes: 0
Views: 238
Reputation: 360872
Generally speaking, for XML queries, node attributes must be prefaced with a @
for matching. You haven't specified what XML library you're using but if it's following conventions/standards, you'd probably want
$data->RoomTypes->RoomType['@roomCode="17918"']->description;
^---
instead.
Upvotes: 1