Home > Backend Development > PHP Tutorial > Solve PHP SimpleXML does not support namespace_PHP tutorial

Solve PHP SimpleXML does not support namespace_PHP tutorial

WBOY
Release: 2016-07-21 14:58:19
Original
881 people have browsed it

Unfortunately, PHP SimpleXML does not natively support parsing XML data with namespaces. For example, there is xml data of Jiangzi:


Mango Station
No I knew how to deal with it, so I felt sick:

$content = "
Mango Station
< /xxx:wrap>";
//Replace string
$content = str_replace('xxx:', '', $content);
//Read the replaced string
$ xml = simplexml_load_string($content);

Filter out all namespaces directly through string replacement. Done in an instant, haha!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/363877.htmlTechArticleUnfortunately, PHP SimpleXML does not natively support parsing XML data with namespaces. For example, there is Jiangzi’s xml data: xxx:wrap xxx:content Mango Station/xxx:content /xxx:wrap I don’t know how...
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