I want to load data from an XML file and assign that data to variables in my Android app.
After doing some research on the various XML parsers available to Android, I figure the best parser method to use would be SAX.
I’ve read through a bunch of posts about reading XML from Android however I can’t find one that uses a local file in the ‘res’ folder.
All the tutorials I’ve found are loading the XML file via a URL.
Is there a way to load the XML from the res folder?
Thanks
You could look at my past question regarding the same issue: How to use DOM to read XML within Android applications correctly?
From my experience I’ve copied the xml file into the
res/rawfolder and was able to read it correctly there usingres.openRawResource(R.raw.the_id). You can load it from theres/layoutfolder but some of the information when you parse it may be in binary, which wouldn’t be ideal.