0
我有follwing字符串:使用標籤的xmlns當轉換字符串數組:soapenv
$string='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bac="http://backupbank.com/"> <soapenv:Header/> <soapenv:Body>
<bac:CreateUser>
<bac:request>
<!--Optional:-->
<bac:username>anandneema</bac:username>
<bac:product>Workstation</bac:product>
<bac:credentials>
<bac:server>serveripaddress</bac:server>
<bac:user>username</bac:user>
<bac:password>password</bac:password>
</bac:credentials>
</bac:request>
</bac:CreateUser> </soapenv:Body> </soapenv:Envelope>';
$xmldata=simplexml_load_string($string);
echo "<pre>"; print_r($xmldata);
它不解析數據。
但是當我使用:
$string='<soapenv:Envelope> <soapenv:Header/> <soapenv:Body>
<bac:CreateUser>
<bac:request>
<!--Optional:-->
<bac:username>anandneema</bac:username>
<bac:product>Workstation</bac:product>
<bac:credentials>
<bac:server>serveripaddress</bac:server>
<bac:user>username</bac:user>
<bac:password>password</bac:password>
</bac:credentials>
</bac:request>
</bac:CreateUser> </soapenv:Body> </soapenv:Envelope>';
$xmldata=simplexml_load_string($string); echo "<pre>"; print_r($xmldata);
其實當我刪除的屬性:xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:bac="http://backupbank.com/"
然後分析數據
任何一個可以建議我是什麼問題是?