Question

I would like to know which is more efficient to get the data from the server by the xml or json. Another question: does XmlPullParser related to parsing xml data that come from the web service? so if I am using json I don't need XmlPullParser ! or there is other uses ! thank you very much

Was it helpful?

Solution

What I've found extremely useful for parsing JSON is Google's gson library. For xml, you can use gson underneath to do the same thing with gson-xml. With a single line of code you can map your JSON/XML to your objects without having to write a single line of parsing code.

If you find performance to be an issue (I'm making this suggestion because these libs make you super productive), there are mechanisms in both to allow you finer grained control. I doubt you'll have problems with performance though.

OTHER TIPS

For a very thoroughly researched answer to the headline question (though focussed on browsers, not android apps), see David Lee's Balisage 2013 paper:

http://www.balisage.net/Proceedings/vol10/html/Lee01/BalisageVol10-Lee01.html

His conclusion, in one line, is that the choice between XML and JSON makes very little difference in itself - though the details of how you do XML or how you do JSON can make a big difference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top