Is XPath much more efficient as compared to DOM and SAX?

前端 未结 5 865
再見小時候
再見小時候 2020-12-07 00:20

I need to parse an xml string and find values of specific text nodes, attribute values etc. I\'m doing this in javascript and was using the DOMParser class for the same. Lat

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 00:50

    Unless you're using the research prototype of streaming XPath, it is very likely that your XPath engine is loading everything into memory, so it will have similar characteristics to DOM. So it rather depends on your definition of 'efficiency'. It's certainly easier to use, and the XPath implementations could change to be more efficient, whereas DOM will always have some representation of the whole document on the client machine, and SAX will always be a lot more awkward to program than XPath.

提交回复
热议问题