差异做使用DOM解析器和SAX解析器Android的XML解析 [英] Difference in doing Android XML Parsing using DOM Parser and SAX Parser

查看:222
本文介绍了差异做使用DOM解析器和SAX解析器Android的XML解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道确切的优势获得了在做使用DOM解析器和SAX解析器Android的XML解析?
是不是像DOM解析器比SAX解析器,反之亦然有利?

请澄清。

谢谢,

解决方案

嗨SAX解析是最好的实现比DOM,请参阅以下这两者之间的区别:

  

DOM

     
      
  1. 节点都是树结构的形式
  2.   
  3. 内存:它占用更多的内存,DOM是pffered在小型XML文档的情况下,只有$ P $
  4.   
  5. 在运行时慢
  6.   
  7. 在存储为对象
  8.   
  9. 编程易于实施
  10.   
  11. 易于导航和使用。
  12.   
     

SAX

     
      
  1. 事件序列
  2.   
  3. 在它不使用pferred对大文件的任何内存$ P $。
  4.   
  5. 在快速运行时,因为上面提到的一点。
  6.   
  7. 对象是要创建。
  8.   
  9. 需要写$ C $下创建对象
  10.   
  11. 在SAX向后导航是不可能的,因为它顺序处理   文件
  12.   

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

解决方案

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

这篇关于差异做使用DOM解析器和SAX解析器Android的XML解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆