I have a XML file that I need to parse in the Android SDK.
How can I read the XML file path from resources?
The XML contains:
<Book>
<Chapter>
<NO> 1 </NO>
<Text> My Lord </Text>
</Chapter>
<Chapter>
<NO> 1 </NO>
<Text> My Lord </Text>
</Chapter>
</Book>
Before parsing xml create one folder inside your resources and put xml file inside that. And try this code.
If you have an XML file in the raw folder in your resources then you can read it with the following code:
I hope this is useful to you.
Put it under
your_project_root\res\xml\
folder. Then you can open it with:There is an example on how to use
XmlResourceParser
here:http://android-er.blogspot.com/2010/04/read-xml-resources-in-android-using.html