Aschwin Wesselius wrote:
Angelo Zanetti wrote:
Hi all,
I have the following segment of XML:

<BookingReference ReferenceSource="api">165432 </BookingReference>

Now I want to get the value of the BookingReference where the
ReferenceSource = "api". In other words I want to get the value 165432.

I have the following code:
$ItemConfirmationReference2 = $xpath->query('BookingReference
ReferenceSource' , $Element);

$ItemConfirmationReference =

The $Element variable passes the node that contains the BookingReference

The tricky part for me is the ="api" part.

Thanks in advance.


Hi Angelo,

Probably it is something along the lines like:


Fairly simple and XPath is way powerful!

Kind regards,

Aschwin Wesselius

Ah, sorry about that:


There was a '/' after BookingReference.....

Kind regards,

Aschwin Wesselius

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to