Home  >  Article  >  Backend Development  >  ,php解析带命名空间的xml

,php解析带命名空间的xml

WBOY
WBOYOriginal
2016-06-13 12:27:221051browse

求助,php解析带命名空间的xml?
xml文件有axis生成的:




{"code":"2","message":"企业名称和企业注册号匹配"}





我想获得ns1:checkQyReturn当中的内容。
请问如何用php获取?
------解决思路----------------------
可以使用new SimpleXmlElement解决

<br />$x = new SimpleXmlElement($str);  <br />foreach($x->entry as $t){  <br />    echo $t->id . "<br >";  <br />    echo $t->updated . "<br />";  <br />    $namespaces = $t->getNameSpaces(true);  <br />    $gd = $t->children($namespaces['ns1']);   <br />    echo $gd->phoneNumber;  <br />} <br />


参考:http://www.neatstudio.com/show-1549-1.shtml

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn