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?

3

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.