简体   繁体   English

使用DOM Parser和SAX Parser进行Android XML解析的区别

[英]Difference in doing Android XML Parsing using DOM Parser and SAX Parser

I would like to know what exact advantage is gained in doing Android XML Parsing using DOM Parser and SAX Parser? 我想知道使用DOM Parser和SAX Parser进行Android XML解析有什么确切的优势?
Is it like DOm parser is advantageous than SAX Parser or vice-versa? 是不是DOm解析器比SAX Parser更有优势,反之亦然?

Please clarify. 请澄清。

Thanks, 谢谢,
Sen

Hi SAX Parsing is the Best one to implement than DOM, see the difference between these two in the following: 您好SAX Parsing是比DOM更好的实现,请看下面这两者之间的区别:

DOM 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 内存:它占用更多内存,DOM仅在小型XML文档的情况下提供
  3. Slower at runtime 在运行时更慢
  4. Stored as an objects 存储为对象
  5. Programmatically easy to implement 以编程方式易于实施
  6. Ease of navigation and use. 易于导航和使用。

SAX 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 在SAX中,向后导航是不可能的,因为它顺序处理文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM