-1

I have the following xml:

<THISVALUECHANGESANDISUNKNOWN>
<TEST></TEST>
</THISVALUECHANGESANDISUNKNOWN>

In PHP I can do something like

preg_match('~<TEST>([^<]+)</TEST>~i', $xml, $test);

But how do I get the value of TEST in android, if the parentnode is unknown?`

Diego
  • 4,011
  • 10
  • 50
  • 76

2 Answers2

0

You could use jsoup.

String xml = "<THISVALUECHANGESANDISUNKNOWN><TEST></TEST></THISVALUECHANGESANDISUNKNOWN>";
Document doc = Jsoup.parse(xml, "", Parser.xmlParser());
String testValue = doc.select("TEST").text();
Davide Pastore
  • 8,678
  • 10
  • 39
  • 53
-1

This is actually pretty easy to do and is described in good detail in the platform docs: http://developer.android.com/training/basics/network-ops/xml.html

Matt T.
  • 539
  • 3
  • 6