android如何解析这段XML

远方夕阳 2011-01-10 04:18:22
android如何解析这段XML呢,其中forecast_conditions节点里的内容为一个对象

<?xml version="1.0"?>
<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1"
row="0" section="0">
<forecast_information>
<city data="Xi'an, Shaanxi" />
<postal_code data="西安" />
<latitude_e6 data="" />
<longitude_e6 data="" />
<forecast_date data="2011-01-10" />
<current_date_time data="2011-01-10 20:00:00 +0000" />
<unit_system data="SI" />
</forecast_information>
<current_conditions>
<condition data="晴" />
<temp_f data="30" />
<temp_c data="-1" />
<humidity data="湿度: 51%" />
<icon data="/ig/images/weather/sunny.gif" />
<wind_condition data="风向: 西南、风速:5 米/秒" />
</current_conditions>
<forecast_conditions>
<day_of_week data="周一" />
<low data="-9" />
<high data="1" />
<icon data="/ig/images/weather/mostly_sunny.gif" />
<condition data="晴间多云" />
</forecast_conditions>
<forecast_conditions>
<day_of_week data="周二" />
<low data="-9" />
<high data="2" />
<icon data="/ig/images/weather/sunny.gif" />
<condition data="晴" />
</forecast_conditions>
<forecast_conditions>
<day_of_week data="周三" />
<low data="-6" />
<high data="3" />
<icon data="/ig/images/weather/sunny.gif" />
<condition data="晴" />
</forecast_conditions>
<forecast_conditions>
<day_of_week data="周四" />
<low data="-9" />
<high data="5" />
<icon data="/ig/images/weather/mostly_sunny.gif" />
<condition data="以晴为主" />
</forecast_conditions>
</weather>
</xml_api_reply>
...全文
84 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
DrSmart 2011-01-10
  • 打赏
  • 举报
回复
哦,这个简单android上的有sax解析google天气的源码,你google下吧,貌似来自anddev.org基本上有一定历史了,应该是3年前的吧
csuhanyong 2011-01-10
  • 打赏
  • 举报
回复
这个按照java的xml解析方式正常去解析即可,或者用android那个pull解析。这个xml没有什么特别之处。

80,359

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧