XPATH VS DOM API,哪一个具有更好的性能 [英] xPath vs DOM API, which one has a better performance

查看:302
本文介绍了XPATH VS DOM API,哪一个具有更好的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,说我的工作就是要同时有很多人在网上的一个项目,我需要为他们提供的数据,从一些XML文件来了。什么是做到这一点,当涉及到性能问题的最好方法是什么?有没有之间的真正差异的XPath DOM 或者我不应该关心,只是继续前进,用一个我最喜欢的?

Well, Say I am working on a project that is gonna have lots of people online simultaneously and I need to provide them with data coming from some XML files. What would be the best way to do that when it comes to performance issues? Is there any real differences between xPath or DOM or I shouldn't care and just go ahead and use the one I like most?

此外,什么是使用正则表达式解析XML或XHTML文件的问题?

Additionally, what is the problem using RegEx to parse a xml or xhtml file?

推荐答案

如果你有兴趣的表现,则有可能是树模型进行比DOM快很多(例如,如果你在Java世界, XOM),并且还提供了更好的易用性。

If you're interested in performance, then there may be tree models that perform much faster than DOM (for example, if you're in the Java world, XOM) and that also offer much better usability.

XPath是一个高级语言,DOM API是低得多的水平。因此,主要的区别是程序员的生产率,易于维护等。作为性能,一个高级语言通常会比一个一流程序员编写超优化code相低层接口慢,但更快比一般的程序员编写平均code反对的最后期限。

XPath is a high-level language, DOM APIs are much lower level. The main difference is therefore programmer productivity, ease of maintenance, etc. As to performance, a high-level language will usually be slower than a top-class programmer writing super-optimized code with a lower-level interface, but faster than an average programmer writing average code against a deadline.

这篇关于XPATH VS DOM API,哪一个具有更好的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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