Difference in doing Android XML Parsing using DOM Parser and SAX Parser

廉价感情. 提交于 2019-12-05 04:35:53

问题


I would like to know what exact advantage is gained in doing Android XML Parsing using DOM Parser and SAX Parser?
Is it like DOm parser is advantageous than SAX Parser or vice-versa?

Please clarify.

Thanks,
Sen


回答1:


Hi SAX Parsing is the Best one to implement than DOM, see the difference between these two in the following:

DOM

  1. The Nodes are in the form of Tree Structure
  2. Memory: It Occupies more memory, DOM is only preffered in the case of small XML documents
  3. Slower at runtime
  4. Stored as an objects
  5. Programmatically easy to implement
  6. Ease of navigation and use.

SAX

  1. Sequence of events
  2. It doesn't use any memory preferred for large documents.
  3. Faster at runtime, because of the above mentioned point.
  4. Objects are to be created.
  5. Need to write code for creating objects
  6. In SAX Backward navigation is not possible as it sequentially processes the document


来源:https://stackoverflow.com/questions/4500297/difference-in-doing-android-xml-parsing-using-dom-parser-and-sax-parser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!