Possible Duplicate:
Android : Reading XML from local resource (for testing)
I have an application in Android which is read list and urls of genres from a XML file. In the 1st phase I should read this XML from local resource and in next phase I should do it from a web service or something. This is XML file:
<?xml version="1.0" encoding="UTF-8"?>
<genres>
<genre>
<id>1</id>
<title>Action</title>
<count>5</count>
<thumb_url>http://www.filmsite.org/images/action-genre.jpg</thumb_url>
</genre>
<genre>
<id>2</id>
<title>Adventure</title>
<count>12</count>
<thumb_url>http://www.filmsite.org/images/adventure-genre.jpg</thumb_url>
</genre>
<genre>
<id>3</id>
<title>Comedies</title>
<count>54</count>
<thumb_url>http://www.filmsite.org/images/comedy-genre.jpg</thumb_url>
</genre>
<genre>
<id>4</id>
<title>Crime</title>
<count>2</count>
<thumb_url>http://www.filmsite.org/images/crime-genre.jpg</thumb_url>
</genre>
<genre>
<id>5</id>
<title>Dramas</title>
<count>3</count>
<thumb_url>http://www.filmsite.org/images/drama-genre.jpg</thumb_url>
</genre>
<genre>
<id>6</id>
<title>Epics</title>
<count>1</count>
<thumb_url>http://www.filmsite.org/images/epics-genre.jpg</thumb_url>
</genre>
<genre>
<id>7</id>
<title>Horror</title>
<count>0</count>
<thumb_url>http://www.filmsite.org/images/horror-genre.jpg</thumb_url>
</genre>
<genre>
<id>8</id>
<title>Musical</title>
<count>0</count>
<thumb_url>http://www.filmsite.org/images/musicals-genre.jpg</thumb_url>
</genre>
<genre>
<id>9</id>
<title>Sci-fi</title>
<count>5</count>
<thumb_url>http://www.filmsite.org/images/scifi-genre.jpg</thumb_url>
</genre>
<genre>
<id>10</id>
<title>War</title>
<count>12</count>
<thumb_url>http://www.filmsite.org/images/war-genre.jpg</thumb_url>
</genre>
<genre>
<id>11</id>
<title>Westerns</title>
<count>0</count>
<thumb_url>http://www.filmsite.org/images/westerns-genre.jpg</thumb_url>
</genre>
</genres>`
First I put this XML in value folder but it gets error and said "Invalid XML" or something. Then I googled whole internet and I found that I should create folder and name it row then put this file in row folder and after that import it like:
Xml.parse(getResources().openRawResource(R.raw.genres.xml),
Xml.Encoding.UTF_8, root.getContentHandler());
but when I create this folder it gets error and doesn't work. And also if you close the Eclipse it wont open till you delete row folder. The problem is I want to read a XML file from local resource but I don't know where to put the file and how to quickly read and parse it. Please help me with this. Thanks a lot.