Reputation: 2845
I want to create a basic RSS feeder app for Android and I don't know which library to choose: SAX or DOM. Which should I choose?
Does anyone have any experience with either on an Android platform? Any tips?
Upvotes: 0
Views: 67
Reputation: 3664
A SAX based parser will allow you to store only the information that you require with an event handler style interface, while DOM based methods will parse the whole file into an object model. Personally I would use SAX for both it's speed and memory advantages (especially on a mobile environment --- if you don't know the length of the XML at runtime, you could end up with a huge model). SAX allows you to construct your own objects/information as required in the format you want without having the default object model stored on top.
In general however, a SAX based parser is useful if the XML contains machine readable data, and a DOM based parser is useful when you have structured document style data. See here for more information.
Upvotes: 2