使用simplexml解析时如何忽略大小写?
问题描述:
can I make simple XML ignore case of the node and attributes names?
like
<eleMent attriBute="aaa">
</ELEMENT>
我可以对节点和属性名称进行简单的XML忽略吗? p>
喜欢 p>
&lt; eleMent attriBute =“aaa”&gt;
&lt; / ELEMENT&gt;
code> pre>
div>
答
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.