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

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

问题描述

我以前使用过 XML 解析器,尽管它运行良好,但总体上我对它并不满意,感觉就像我在使用一些应该是基本功能的东西的变通方法.

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天全站免登陆