,php解析带命名空间的xml

WBOY
Release: 2016-06-13 12:27:22
Original
1050 people have browsed it

求助,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 />
Copy after login


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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!