How read a local xml file in android
<p>I am trying to read a local xml file from res/xml/myxml.xml
This is the xml,</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;Books&gt;
  &lt;Number id ="1"&gt;
    &lt;Description&gt;This is science book.
    &lt;/Description&gt;
  &lt;/Number&gt; 
  &lt;Number id = "2"&gt;
    &lt;Description&gt;This is about cooking.
   &lt;/Description&gt;
  &lt;/Number&gt;
&lt;/Books&gt;
</code></pre>

<p>Here is the code,</p>

<pre><code>XmlResourceParser pars = res.getXml(R.xml.myxml);
while (pars.getEventType() != XmlResourceParser.END_DOCUMENT) {
    if (pars.getEventType() == XmlResourceParser.START_TAG) {
              if(pars.getName().equals("Number")) {
                   int id = pars.getAttributeIntValue(null, "id", 0);
              }
        }
    pars.next();
}
pars.close();
</code></pre>

<p>The above code returns the last id of the xml.
How can I check to see if the id == certain integer, than display the description in the textview.
Sorry I am new to android and java. I will really appreciate your help.
Thanks</p>
