I place the local XML file into res/raw
and then loads it into InputStreamer
object. It works fine and I am able to parse its content.
When I place the same XML into res/xml
, I get XmlPullParserException
saying it can't find the START tag.
I use this code to fill InputStream
object:
InputStream is = getResources().openRawResource(R.raw.data);
and this line to load the XML from /res/xml
:
InputStream is = context.getResources().openRawResource(R.xml.data);
Why is this happening? If the 2nd approach is the wrong one, what is then the purpose of res/xml
?