How to get a node value with XmlPullParser

DecodeGnome picture DecodeGnome · Sep 28, 2011 · Viewed 7.5k times · Source

Im trying to get values from an XML with the XmlPullParser but can't reach the values I want. The XML-structure is similar to the Android Strings.xml:

<string name="value"> 1 </string>

I can get "string", "name" & "value" from the XML but can't reach the actual value "1". It seems like the XmlPullParser only works for structures like this:

<value> 1 </value>

Do I need to use another parser or is there a way to reach "1" (the value above) in some way?

Thanks!

Answer

k7k0 picture k7k0 · Nov 1, 2011

nextText() method will do the trick