0

I followed a tutorial located here: http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/ and so far everything worked fine with it. However this only worked nice when there were specific XML tags to go through, such as:

<tag1>
<gettag></gettag>
<gettag2></gettag2>
</tag1>

However my main issue is that I need to get multiple items from within a single tag, like this:

<tag1>
<tag2>text</tag2>
<tag2>text again</tag2>
<tag2>more text</tag2>
</tag1>   

I am not able to use the tutorial code to get all of the tag2 items (it stops at the first one). Does anyone know of a good way to grab those "tag2" tags above and spit out the results into a listview?

Any help is appreciated.

Appli-Brad
  • 65
  • 2
  • 7

1 Answers1

1

Something you may need to do is,

keep a list, If endElement() is tag2, add readtext to list. if endElement is tag1, then create new List and elements.

Check this discussion.

Community
  • 1
  • 1
kosa
  • 65,990
  • 13
  • 130
  • 167
  • Perfect. The start and end elements seem to work perfectly. That discussion did not provide an immediate answer but gave me enough information to figure it out. – Appli-Brad Mar 16 '12 at 15:18