无法在PHP中将XML转换为Object - 返回空对象

时间:2014-01-20 18:46:01

标签: php xml soap simplexml

以下是我尝试使用simplexml_load_string()转换的XML。

$THE_XML = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
  <ns:getMarketsByNpaNxxResponse xmlns:ns="http://ws.inventory.ccds.com" xmlns:ax251="http://exceptions.commons.ccds.com/xsd" xmlns:ax250="http://exceptions.ccds.com/xsd" xmlns:ax260="http://availability.item.productsservices.ccds.com/xsd" xmlns:ax259="http://detail.item.productsservices.ccds.com/xsd" xmlns:ax264="http://item.productsservices.ccds.com/xsd" xmlns:ax257="http://ws.inventory.ccds.com/xsd" xmlns:ax255="http://security.ccds.com/xsd"><ns:return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax257:Market">
    <ax257:marketId>30</ax257:marketId>
    <ax257:marketName>AZ-FLAGSTAFF</ax257:marketName> 
    <ax257:npaNxxs>928863</ax257:npaNxxs>
    </ns:return>
  </ns:getMarketsByNpaNxxResponse>
</soapenv:Body>
</soapenv:Envelope>';


$RESULT = simplexml_load_string($THE_XML);

var_dump($RESULT);

返回:

object(SimpleXMLElement)#3 (0) {
}

我做错了什么?

0 个答案:

没有答案