利用YAHOO公开API做天气预报Web服务..doc
文本预览下载声明
利用YAHOO公开API做天气预报Web服务原理:
?在Yahoo的Developer Network/weather/详细地介绍了Yahoo天气预报的API调用方法,这里用C#来实现,本文主要是利用它的API做Web服务,其它的应用由网友们自由发挥首先了解Yahoo Weather Api的RSS Response格式(这是下午我查我家银川天气时返回的RSS):
?
?xml?version=1.0?encoding=UTF-8?standalone=yes??rss?version=2.0?xmlns:yweather=/ns/rss/1.0?xmlns:geo=/2003/01/geo/wgs84_pos#??channel????titleYahoo!?Weather?-?Yinchuan,?CH/title????link/dailynews/rss/weather/Yinchuan__CH/*[url]/forecast/CHXX0259_f.html[/url]/link????descriptionYahoo!?Weather?for?Yinchuan,?CH/description????languageen-us/language????lastBuildDateTue,?14?Oct?2008?11:00?am?CST/lastBuildDate????ttl60/ttl????yweather:location?city=Yinchuan?region=??country=CH/????yweather:units?temperature=F?distance=mi?pressure=in?speed=mph/????yweather:wind?chill=56??direction=360??speed=4?/????yweather:atmosphere?humidity=56??visibility=999??pressure=??rising=0?/????yweather:astronomy?sunrise=7:03?am??sunset=6:19?pm/????image??????titleYahoo!?Weather/title??????width142/width??????height18/height??????link/link??????url//i/us/nws/th/main_142b.gif/url????/image????item??????titleConditions?for?Yinchuan,?CH?at?11:00?am?CST/title??????geo:lat38.48/geo:lat??????geo:long106.22/geo:long??????link/dailynews/rss/weather/Yinchuan__CH/*[url]/forecast/CHXX0259_f.html[/url]/link??????pubDateTue,?14?Oct?2008?11:00?am?CST/pubDate??????yweather:condition??text=Mostly?Cloudy??code=28??temp=56??date=Tue,?14?Oct?2008?11:00?am?CST?/??????description????????![CDATA[img?src=[img]//i/us/we/52/28.gif[/img]/br?/bCurrent?Conditions:/bbr?/Mostly?Cloudy,?56?FBR?/BR?/bForecast:/bBR?/Tue?-?Mostly?Cloudy.?High:?68?Low:?47br?/Wed?-?Partly?Cloudy.?High:?70?Low:?44br?/br?/a?href=Full/dailynews/rss/weather/Yinchuan__CH/*/forecast/CHXX0259_f.htmlFull?Forecast?at?Yahoo!?Weather/aBR/(provided?by?The?Weather?Channel)br/]]??????/description??????yweather:forecast?day=Tue?date=14?Oct?2008?low=47?high=68?text=Mostly?Cloudy?code=28?/??????yweather:forecast?day=Wed?date=15?Oct?
显示全部