开发者

How to ignore case when parsing with simplexml?

开发者 https://www.devze.com 2023-04-03 10:14 出处:网络
can I make simple XML ignore case of the node and attributes names? like <eleMent attriBut开发者_如何学Goe=\"aaa\">

can I make simple XML ignore case of the node and attributes names?

like

<eleMent attriBut开发者_如何学Goe="aaa">

</ELEMENT>


can I make simple XML ignore case of the node and attributes names?

No.


The only way I see is to change the case of the xml string you want to parse before the call of SimpleXMLElement. Something like this :

$content = mb_strtolower(file_get_contents('myfile.xml'), 'UTF-8');
$simpleXmlElement = new SimpleXMLElement($content);

Be aware that you will have performance issue using this method with big XML.

0

精彩评论

暂无评论...
验证码 换一张
取 消