Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Best parser to parse XML data [closed]

I am developing an application in which the first time I am going to parse data from an xml file coming from a remote server.

But i am not able to select which parser is efficient or best suited for parsing. As there are mainly three types of parsing, which i know :

  1. SAX
  2. XMLPullParsing
  3. DOM

Which is the best parser to parse data? As I searched on Google and found the positive and negative both sides of the above parsers. But I was not able to determine which is the most efficient.

The XML has heavy data with a number of tags.

Please guide me and suggest me which parser I should use as I am using parsing in my application for first time.

like image 454
Manoj Fegde Avatar asked Mar 25 '13 06:03

Manoj Fegde


1 Answers

SAX Parsing is the Best one to implement than DOM. See the difference between these two in the following:

DOM:

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

SAX:

  • Sequence of events.
  • It doesn't use any memory preferred for large documents.
  • Faster at runtime, because of the above mentioned point.
  • Objects are to be created.
  • Need to write code for creating objects.
  • In SAX Backward navigation is not possible as it sequentially processes the document.
like image 65
Prashant Shilimkar Avatar answered Sep 29 '22 17:09

Prashant Shilimkar