Php simplexml\u加载\u字符串未创建对象
我的XML是:Php simplexml\u加载\u字符串未创建对象,php,simplexml,Php,Simplexml,我的XML是: <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body>
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<FindOrders xmlns="http://www.JOI.com/schemas/ViaSub.WMS/">
<orders>
<order>
<MarkForName />
<BatchOrderID />
<CreationDate>2013-08-09T17:41:00</CreationDate>
<EarliestShipDate />
<ShipCancelDate />
<PickupDate />
<Carrier>USPS</Carrier>
<BillingCode>Prepaid</BillingCode>
<TotWeight>0.00</TotWeight>
<TotCuFt>0.00</TotCuFt>
<TotPackages>1.0000</TotPackages>
<TotOrdQty>1.0000</TotOrdQty>
<TotLines>1.00</TotLines>
<Notes />
<OverAllocated />
<PickTicketPrintDate />
<ProcessDate />
<TrackingNumber />
<LoadNumber />
<BillOfLading />
<MasterBillOfLading />
<ASNSentDate />
<ConfirmASNSentDate />
<RememberRowInfo>398879:12:2:::0:False</RememberRowInfo>
</order>
</orders>
</FindOrders>
<totalOrders xmlns="http://www.JOI.com/schemas/ViaSub.WMS/">1</totalOrders>
</soap:Body>
</soap:Envelope>
我得到:simplexmlement对象()
,而不是一个包含所有这些参数的对象。这是为什么?您缺少用于SOAP的
结果()
我猜当你说你想看到一个包含所有这些参数的对象时,你想输出你刚刚创建的xml文档 查看上的文档,您需要执行以下操作:
echo $a->asXML();
$a = simplexml_load_string($str);
$a->registerXPathNamespace('soap', 'http://www.w3.org/2003/05/soap-envelope');
$result = $a->xpath('//soap:Body');
print_r($result);
Array
(
[0] => SimpleXMLElement Object
(
[FindOrders] => SimpleXMLElement Object
(
[orders] => SimpleXMLElement Object
(
[order] => SimpleXMLElement Object
...
...
echo $a->asXML();