views:

55

answers:

2

Hi,

I have a huge set of xmls(2000 files each having 500 lines) to be parsed in Android for fetching the information from it. All the files will be present in the device. I had this to be done in iPhone and i accomplished it by converting all the XMLs to PLIST files. The PLIST processing in a iOS was faster than parsing a XML in iphone. Similarly for android is there any options available? or What are the best way to parse those XMLs in android as i feel the same problem we had in iphone(performance incurred in parsing) will be here also?

+1  A: 

I don't know which parsing mechanism you've used on iOS and how they behave there. All I can tell you that you should consider using the SAX parser over all other available parsing mechanisms.

The SAX parser produces a relatively small memory footprint compared to the DOM parser as it doesn't load the whole document into memory first. It reads the document line by line and informing you of events like starting tag, content, ending tag and the like as they appear.

Here is the reference page on one of the SAX implementations shipped with Android. There is an Android SAX implementation too you have to find out yourself which one works best for you.

Good luck.

Octavian Damiean
+1  A: 

I'd use XML pull parsing. Here's the class for it. Some info about xml processing performance

Afaik, in the new Android version (2.2) they implemented a better json parser. I think you should try converting your xmls to json format, and try both out.

Scythe