适用于PHP的最佳XML解析器 [英] Best XML Parser for PHP
问题描述
我以前使用过XML Parser,尽管它工作正常,但总体上我并不满意,感觉就像我在使用变通方法来处理应该是基本功能的事情.
I have used the XML Parser before, and even though it worked OK, I wasn't happy with it in general, it felt like I was using workarounds for things that should be basic functionality.
我最近看到了SimpleXML,但是我还没有尝试过.有没有更简单的方法?两者都有哪些优点和缺点?您使用过其他解析器吗?
I recently saw SimpleXML but I haven't tried it yet. Is it any simpler? What advantages and disadvantages do both have? Any other parsers you've used?
推荐答案
我不得不说 SimpleXML 之所以选择蛋糕,是因为它首先是用C编写的扩展,并且非常快.但是第二,解析后的文档采用PHP对象的形式.因此,您可以像$root->myElement
一样查询".
I would have to say SimpleXML takes the cake because it is firstly an extension, written in C, and is very fast. But second, the parsed document takes the form of a PHP object. So you can "query" like $root->myElement
.
这篇关于适用于PHP的最佳XML解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!