SimpleXmlElement und XPath, leeres Array erhalten ()
Ich habe ein kleines Problem mit dem Parsen von XML aus einer Google Checkout-Antwort. Der XML-Code kommt direkt vom Google-Server, sodass kein Problem mit dem XML-Code selbst besteht.
Ich möchte alle Benachrichtigungs-Tags für neue Bestellungen erhalten
Ich habe es versucht, aber jedes Mal wird ein leeres Array () zurückgegeben.
$xml = new SimpleXmlElement($raw_xml);
$notifications = $xml->xpath('notifications');
$notifications = $xml->xpath('/notification-history-response/notifications/new-order-notification');
$notifications = $xml->xpath('//new-order-notification');
Ein XML-Snipet (nur der Anfang)
<notification-history-response xmlns="http://checkout.google.com/schema/2" serial-number="c5cda190-0eb1-4f91-87cd-e656e5598d38">
<notifications>
<new-order-notification serial-number="271578974677716-00001-7">
<buyer-billing-address>
<address1>19 sandbox st</address1>
<address2></address2>