C#谷歌的天气越来越XML [英] c# google weather xml getting
问题描述
我想从 http://www.google.com/ig/api?weather=
获取天气我用这个
i want get weather from http://www.google.com/ig/api?weather=
I use this
// load xml result from Google weather
var addr = WebUtility.HtmlEncode("http://www.google.com/ig/api?weather=vilnius&hl=lt");
XDocument xd = XDocument.Load(addr);
// navigate to current conditions node
var current_conditions = from currentCond in xd.Root.Descendants("current_conditions")
select currentCond;
// navigate to Forecast info node
var forcastInfo = from forecastinfo in xd.Root.Descendants("forecast_information")
select forecastinfo;
我用网址 http://www.google.com/ig/api?weather=vilnius&hl=lt
,但得到的信息用英文,我不能找到问题,请帮助:)
I use url http://www.google.com/ig/api?weather=vilnius&hl=lt
but information get in english, I can't find problem please help :)
推荐答案
请参阅我的回答你的<一个href=\"http://stackoverflow.com/questions/10455335/loading-xml-to-an-xdocument-with-a-url-containing-an-ampersand\">original问题 - 无需WebUtility.HtmlEn code,你得到放; HL = LT查询参数,而不是HL = LT
See my answer to your original question - no need for WebUtility.HtmlEncode as you get "amp;hl=lt" query parameter instead of "hl=lt".
英语成绩: http://www.google.com/ig/api?weather=vilnius&hl=lt
非英语成绩: http://www.google.com/ig/api?weather=vilnius&hl=lt
这篇关于C#谷歌的天气越来越XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!