使用simplexml_load_string解析这段XML报错。
$data = <<<XML
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="JobSendedDescription">
<RetCode>Sucess</RetCode>
<JobID>183372602</JobID>
<OKPhoneCounts>1</OKPhoneCounts>
<StockReduced>1</StockReduced>
<ErrPhones />
</ROOT>
XML;
$xml = simplexml_load_string($data);
var_dump($xml);
报错内容是警告级别的,报错内容如下
Warning: simplexml_load_string(): namespace warning : xmlns: URI JobSendedDescription is not absolute in D:\laragon\www\index.php on line 11
Warning: simplexml_load_string(): tance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="JobSendedDescription" in D:\laragon\www\index.php on line 11
Warning: simplexml_load_string(): ^ in D:\laragon\www\index.php on line 11
我把xmlns="JobSendedDescription"改成xmlns:URI="JobSendedDescription",警告级别报错就消除了,请问是这段XML语法有问题还是simplexml_load_string解析不了这种XML?
添加回答
举报
0/150
提交
取消