why xml parsing in android
why do we need xml parsing in android and which one is really better (开发者_开发技巧SAX,DOM.PULL)
I'm not sure why you're asking "Why do we need XML parsing in Android?" since the question seems to answer itself: to parse XML data. For example, there are many web services which return data in an XML format which will need to be parsed before you can use it in your application.
Here's an article at Developer.com comparing the performance of the DOM, SAX and Pull parsers on Android. It found the DOM parser to be by far the slowest, then the Pull parser and the SAX parser the fastest in their test. Here's another article at IBM that covers the three methods with sample code.
If you're going to be a doing a lot of parsing in your application it may be worth benchmarking the different options to see which works best for you.
精彩评论