How to choose a particular element from XML file?

There is a XML file voprosi.xml
<?xml version="1.0" encoding="utf-8"?>
 <issue>what is 2+2?</issue>
 <otvet_4 name="pravilno">4</otvet_4>
 <issue>what is 3+3?</issue>
 <otvet_4 name="pravilno">6</otvet_4>
 <issue>How much is 4+4?</issue>
 <otvet_4 name="pravilno">8</otvet_4>
 <issue>How much is 5+5?</issue>
 <otvet_4 name="pravilno">10</otvet_4>

I have to get in aktiviti Question 3 and the answer choices

Java code that retrieves data from XML file

try {
 XmlPullParser parser = getResources().getXml(R. xml.voprosi);

 while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
 if (parser.getEventType() == XmlPullParser.START_TAG
 && parser.getName().equals("question")) {


//....... here it is necessary to bring out both the question and the answers 


 } catch (Throwable t) {
 "Error loading XML document:" + t.toString(),

Perhaps you can output the data so as not to parse the whole file but only the item number?
March 19th 20 at 08:29
1 answer
March 19th 20 at 08:31
with a strong desire - you can if you go to the block structure of the file,
i.e. when each tag <question> is strictly N bytes (the remainder can be supplemented by spaces)
then the desired block is in one step: the block number*N
but in a real project for that will beat not only the hands of time
there is a parser, there are objects, aspartyl - received, the decision is valuable for its predictability and ease of maintenance
PS: the tags of the form<otvet_1>12</otvet_1>better not to show anyone
so is correct:
<question id="1" text="what is 4+4?" > - make the question attributes to simplify parsing
<item id="1" right="true">8</item>
<item id="2" >44</item>

Find more questions by tags XMLAndroid