Android: the best parser for parsing XML data

I am developing an application in which for the first time I will parse data from an XML file coming from a remote server.

But I cannot choose which parser is efficient or best suited for parsing. Since there are basically three types of parsing that I know:

  • Sax
  • XMLPullParsing
  • Dom

What is the best parser for data analysis? . When I searched on Google and found the positive and negative sides of both parsers. But I could not determine which one is most effective.

XML has heavy data with multiple tags.

Please advise and suggest to me which parser I should use, since at first I use parsing in my application.

+6
source share
4 answers

In all XML parsers, the Sax parser is the fastest, so you can no doubt go for it. If you need to read and write data from XML, you can go for the DOM. Using the SAX parser, you can only read data from XML. Since these two are at the top of the list, you do not need to think about XMLPullparser.

+9
source

SAX Parsing is better for implementation than DOM. See the difference between the two in the following:

Dom

  • The nodes are in the form of a tree structure.
  • Memory: it takes up more memory, the DOM is used only in the case of small XML documents.
  • Slower at runtime.
  • Saved as an object.
  • Software is easy to implement.
  • Easy navigation and use.

Sax

  • Sequence of events.
  • It does not use the memory preferred for large documents.
  • Faster at runtime due to the above point.
  • Objects must be created.
  • You must write code to create objects.
  • In SAX, reverse navigation is not possible because it sequentially processes the document.
+18
source

I would say that XMLPullParsing, but lately I've heard great things about Xerces , may want to look at this one as well. However, I never used Xerces, and XMLPullParser never let me down. We are creating a color track app that used it, and it draws thousands of color combinations to tell you what color you just made.

update : there are several links for reading, if you do not read: p, it shows cons and perks on both sides

http://www.firstobject.com/xml-reader-sax-vs-xml-pull-parser.htm

Another answer, perhaps to reading the SAX parser and XMLPull

+1
source

I think XMLPullParser would be a good option, as they mentioned in the documentation for Android .

0
source

All Articles