Memory Issues When DOM Parsing A Large XML File on Android Devices
Posted
by tonyc
on Stack Overflow
See other posts from Stack Overflow
or by tonyc
Published on 2010-06-15T20:28:10Z
Indexed on
2010/06/15
20:32 UTC
Read the original article
Hit count: 366
Hey awesome SO users,
I have an Android application that parses an XML file for users and displays results in a much more mobile friendly format. The app works great for most users, but some users have lots and lots of data and the app crashes on them because it runs out of memory.
Is there any way I have a DOM style XML parser quit parsing data after a certain amount of parsing? I only need the first 30 or so elements so it would make the application much more efficient.
I'd like to use a SAX or pull parser instead, but the XML I'm parsing is not valid and I have no control over it. Unless anyone has some good SAX solutions that let me parse messy, invalid XML, I think DOM is the only way to go.
Thanks for reading!
© Stack Overflow or respective owner