SimpleXML xpathを使用して、タグ名にコロンが含まれるタグを解析する簡単な方法はありますか?
例:
<v12:ProcessShipmentResponse>SUCCESS</v12:ProcessShipmentResponse>
これは、名前空間が付けられていないが、名前空間が付けられたタグで壊れているタグを解析するために使用するコードです。
$xml = simplexml_load_string($responseXMLL, NULL, NULL, 'http://schemas.xmlsoap.org/soap/envelope/');
foreach ($xml->xpath('soapenv:Body') as $body) {
$custInfoArr['status'] = (string) $body->v12:ProcessShipmentReply->v12:HighestSeverity;
$custInfoArr['trackingCode'] = (string) $body->v12:ProcessShipmentReply->v12:CompletedShipmentDetail->v12:CompletedPackageDetails->v12:TrackingIds->v12:TrackingNumber;
$custInfoArr['labelCode'] = (string) $body->v12:ProcessShipmentReply->v12:CompletedShipmentDetail->v12:CompletedPackageDetails->v12:Label->v12:Parts->v12:Image;
}