xPath vs DOM API, which one has a better performance

前端 未结 2 775
有刺的猬
有刺的猬 2021-01-03 12:25

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 th

相关标签:
2条回答
  • 2021-01-03 12:45

    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.

    0 讨论(0)
  • 2021-01-03 12:57

    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 讨论(0)
提交回复
热议问题