I have a web service, .asmx that when consumed gives a response in the form:
<lData>
<name>...</name>
<posx>..</posx>
<posy>...</posy>
</lData>
I use Ksoap2 to consume the web service in Android, and I see the response as a string:
anyType {
lData = anyType{
name=....;
posx=....;
posy=....
;}
;}
So, I get the right data from my web service, but i don’t know how to parse it correctly.
I want to find a way to iterate through the different nodes.
I have tried to use a SAXParser, but can’t seem to understand what I should use instead of the url. In the tutotirals I have followed the link to a xml-file on a url, but my url is only part “finished” since i need to consume the web service first.
MyXMLHandler myXMLHandler = new MyXMLHandler();
xr.setContentHandler(myXMLHandler);
xr.parse(new InputSource(sourceUrl.openStream()));
Is this above something I should use, but have another openStream?
Thanks for any help!
The SAXParser wants an InputStream to parse. I think you are saying that you have a string of xml you want to parse? To do so, you need to turn your String into an input stream: