适用于PHP的最佳XML解析器 [英] Best XML Parser for PHP

查看:82
本文介绍了适用于PHP的最佳XML解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前使用过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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆