安卓:DOM VS SAX VS XMLPullParser解析? [英] Android: DOM vs SAX vs XMLPullParser parsing?

查看:211
本文介绍了安卓:DOM VS SAX VS XMLPullParser解析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我解析使用SAX解析器XML文档。

I am parsing XML Document using SAX Parser.

我想知道哪个是更好,更快地一起工作的 DOM SAX解析器 XMLPullParser

I want to know which is better and faster to work with DOM, SAX Parser or XMLPullParser.

推荐答案

这取决于你在做什么,如果你有非常大的文件,那么你应该使用SAX解析器,因为它会触发事件和释放他们,没有什么是存储在内存,并使用SAX解析器,你不能访问以随机的方式有没有回头路元! ,但大教堂让你访问任何部分的XML文件,因为它使整个文件/文件在内存中。希望这回答你的问题。

it depends on what are you doing , if you have very large files then you should use SAX parser since it will fire events and releasing them ,nothing is stored in memory ,and using SAX parser you can't access element in a random way there is no going back ! , but Dom let you access any part of the xml file since it keeps the whole file/document in memory . hope this answer you question .

如果你想知道哪些最快的解析器的Xerces 将是最快的,你会发现和SAX解析器应该给你比DOM更多的性能

if you want to know which fastest parser Xerces is going to be the fastest you'll find and SAX parser should give you more performance than Dom

这篇关于安卓:DOM VS SAX VS XMLPullParser解析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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