Android Json 数据解析 II 之 ------xml ,json 两种数据格式之对比

输入:  http://maps.googleapis.com/maps/api/geocode/xml?address=SFO&sensor=false  可看到 xml格式数据

<?xml version="1.0" encoding="UTF-8" ?>

- < GeocodeResponse >
  < status > OK </ status >
- < result >
  < type > airport </ type >
  < type > airport </ type >
  < type > establishment </ type >
  < formatted_address > 旧金山国际机场 (SFO), 旧金山, 加利福尼亚州 94128, 美国 </ formatted_address >
- < address_component >
  < long_name > 旧金山国际机场 </ long_name >
  < short_name > 旧金山国际机场 </ short_name >
  < type > establishment </ type >
  </ address_component >
+ < address_component >
  < long_name > 旧金山 </ long_name >
  < short_name > SF </ short_name >
  < type > locality </ type >
  < type > political </ type >
  </ address_component >
+ < address_component >
  < long_name > 南旧金山 </ long_name >
  < short_name > 南旧金山 </ short_name >
  < type > administrative_area_level_3 </ type >
  < type > political </ type >
  </ address_component >
+ < address_component >
  < long_name > 圣马刁县 </ long_name >
  < short_name > 圣马刁县 </ short_name >
  < type > administrative_area_level_2 </ type >
  < type > political </ type >
  </ address_component >
+ < address_component >
  < long_name > 加利福尼亚州 </ long_name >
  < short_name > CA </ short_name >
  < type > administrative_area_level_1 </ type >
  < type > political </ type >
  </ address_component >
+ < address_component >
  < long_name > 美国 </ long_name >
  < short_name > US </ short_name >
  < type > country </ type >
  < type > political </ type >
  </ address_component >
+ < address_component >
  < long_name > 94128 </ long_name >
  < short_name > 94128 </ short_name >
  < type > postal_code </ type >
  </ address_component >
- < geometry >
+ < location >
  < lat > 37.6152230 </ lat >
  < lng > -122.3899790 </ lng >
  </ location >
  < location_type > APPROXIMATE </ location_type >
- < viewport >
- < southwest >
  < lat > 37.5975438 </ lat >
  < lng > -122.4219938 </ lng >
  </ southwest >
+ < northeast >
  < lat > 37.6328980 </ lat >
  < lng > -122.3579642 </ lng >
  </ northeast >
  </ viewport >
- < bounds >
- < southwest >
  < lat > 37.6043769 </ lat >
  < lng > -122.4014108 </ lng >
  </ southwest >
+ < northeast >
  < lat > 37.6392104 </ lat >
  < lng > -122.3549166 </ lng >
  </ northeast >
  </ bounds >
  </ geometry >
  </ result >
  </ GeocodeResponse >
 
{
  "status": "OK",
  "results": [ { "types": [ "airport", "airport", "establishment" ],
   	      "formatted_address": "旧金山国际机场 (SFO), 旧金山, 加利福尼亚州 94128, 美国",
    	      "address_components": [
 { "long_name": "旧金山国际机场","short_name": "旧金山国际机场","types": [ "establishment" ]}, 
{"long_name": "旧金山","short_name": "SF", "types": [ "locality", "political" ]}, 
{"long_name": "南旧金山","short_name": "南旧金山","types": [ "administrative_area_level_3", "political" ] },
{"long_name": "圣马刁县","short_name": "圣马刁县","types": [ "administrative_area_level_2", "political" ]},
{"long_name": "加利福尼亚州","short_name": "CA","types": [ "administrative_area_level_1", "political" ] },
{"long_name": "美国","short_name": "US","types": [ "country", "political" ]},{"long_name": "94128", "short_name": "94128","types": [ "postal_code" ]}],
    "geometry": {"location": {"lat": 37.6152230,"lng": -122.3899790},
    "location_type": "APPROXIMATE","viewport": {
    "southwest": {"lat": 37.5975438,"lng": -122.4219938},
    "northeast": {"lat": 37.6328980,"lng": -122.3579642}},
     "bounds": {"southwest": {"lat": 37.6043769, "lng": -122.4014108},
                     "northeast": {"lat": 37.6392104,"lng": -122.3549166}}
    }
  } ]
}
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值