How to ignore case when parsing with simplexml?

醉酒当歌 提交于 2019-12-24 00:44:51

问题


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

like

<eleMent attriBute="aaa">

</ELEMENT>

回答1:


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

No.




回答2:


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.



来源:https://stackoverflow.com/questions/7353784/how-to-ignore-case-when-parsing-with-simplexml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!