我在解析Google Checkout响应的XML时遇到了一些小问题。XML直接来自Google服务器,因此XML本身没有问题。
我想获取所有新订单通知标签。
我尝试过这个方法,但每次都返回一个空数组()。
$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');
一个 XML 片段(仅开头部分)
<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>