Im Rick James
Im Rick James

Reputation: 255

string to XML Android

I have a XML string comming from a Rest WS that I created on .net, I am able to consume the websevice and get the return I need, however this returns comes back as String.

XML from WS:

<Example>
  <Name> Carlos </name>
  <ID> 1 </ID>
</Example>

Once retrieved in Java, it looks like this:

 String response = "<Example> <Name> Carlos </name> <ID> 1 </ID> </Example>"

My idea is to parse this back to XML so I can work with it, I already have a handler class that would take these values, but I cant figure out how to parse it.

My idea is to populate a list adapter with this information since it would return many Names and IDs on a single query.

Thanks

Upvotes: 1

Views: 643

Answers (1)

Reno
Reno

Reputation: 33792

My idea is to parse this back to XML

I think you mean you want to create some kind of Structure containing those strings.

You have options of using the Pull Parser, SAX Parser or DOM based parser

I suggest you use the lightweight SAX parser for this

Upvotes: 1

Related Questions