The best answer is ignoring your parse(new InputSource()) request parse(new InputSource()) . Put it in res/xml/ and use getResources().getXml() . This gives you XmlPullParser for your data. The big advantage here is that your XML is somewhat pre-parsed during the compilation phase, and therefore it is approximately 10 times faster during parsing than with regular XML parsers.
If you absolutely must use the DOM or SAX, put it in res/raw/ , then use getResources().openRawResource() to get an InputStream that you can wrap in an InputSource .
source share