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
Post a Comment