开发者

xPath vs DOM API, which one has a better performance

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 lik开发者_C百科e most?

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


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 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.


Use whichever you want, the performance difference is likely negligible. As to your last question, please see this answer:

https://stackoverflow.com/questions/1732454

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜