I would like to parse a XML file using a XMLPullParser. The code is:
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setValidating(false);
XmlPullParser myxml = factory.newPullParser();
InputStream raw = getApplicationContext().getAssets().open("etat_cree.xml");
myxml.setInput(raw, null);
The file "etat_cree.xml" is a basic XML file I only created to test my code. The problem I have is that a FileNotFoundException is launched whenever I try to create the InputStream raw variable as if the file wasn't found.
I saved the file "etat_cree.xml" inside the directory "res/xml" (I saved it in "res" because it is a resource file and in the sub-directory xml because it is a XML file).
As the XML file is not found, I guess "res/xml" is not the right place to save it but I do not know where else to save it.
So my question is, where should I save the XML file so that I could access it from the Java code ?
Thanks !
You can put it in the assets folder or sub folders of the assets folder.