How to extract a value of a http xml answer using android java -


well i'm kinda new android , i'm trying value of http answer. never worked xml stuff before.

example of web service : http://freegeoip.net/xml/123.123.123.123

this result here

<response> <ip>123.123.123.123</ip> <countrycode>cn</countrycode> <countryname>china</countryname> <regioncode>22</regioncode> <regionname>beijing</regionname> <city>beijing</city> <zipcode/> <latitude>39.9289</latitude> <longitude>116.388</longitude> <metrocode/> </response> 

how value of countrycode, regioncode etc...

you should use sax api (simple api xml) parse xml webservice , handle defaluthandler class.here's documentation of defaulthandler class: http://developer.android.com/reference/org/xml/sax/helpers/defaulthandler.html , here's nice tutorial 0 should you: http://www.codeproject.com/articles/334859/parsing-xml-in-android-with-sax


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -