I’m building an android app and I have a xml file which is my data source, I load it to make queries using XPath and then load the results in a ListView. The problem comes out when the xml file start to become bigger(up to 10MB). It means that i could have problems with memory, i guess. I would like to know what’s the best way to load the xml and make searchs into the file without compromise the device’s memory or waste valuable time processing data.
Here is when i load the xml file:
InputStream isRaw = context.getResources().openRawResource(R.raw.xmlbooksource);
_xmlBookSource = new InputSource(isRaw);
And here i make a query using XPath:
nodeResultSet = (NodeList) xpath.evaluate(xpathExpression, _xmlBookSource, XPathConstants.NODESET);
all advices are welcome.