androidxmlpullparser

How to get a node value with XmlPullParser


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!


Solution

  • Have you checked the documentation of the XmlPullParser? It has an example how to use it. Basically you can get the value inside the tags by calling getText when the parser reaches correct position when you're calling next.