0

I have XML in the form of a String that contains:

<Data>
  <id>6731</id>
  <aux>82</aux>
</Data> 

How can I get the values 6731 and 82 from the XML? The XML isn't in a document, it's simply a String. Thanks in advance. Actually, I tried XmlPullParser but i think that only works for xml files or URLs, not for Strings. Am I right?

Arnab Nandy
  • 6,472
  • 5
  • 44
  • 50
Sophie
  • 3
  • 5

1 Answers1

0

you can use three one of three libs: DOM Parser SAX Parser StAX Parser

see: https://www.javacodegeeks.com/2013/05/parsing-xml-using-dom-sax-and-stax-parser-in-java.html

Also for Android: https://developer.android.com/training/basics/network-ops/xml.html

Oleg Skidan
  • 617
  • 6
  • 24