あなたは一例として、これを使用することができますが動作しません。これは私が天気を引き出す方法です。あなたのやっていることと同じことですが、別の方法を使用しています。私が示していたコードは、次に単語温度を見て例
private void GetWeather()
{
string query = string.Format("http://weather.yahooapis.com/forecastrss?w=12773086");
XmlDocument wData = new XmlDocument();
wData.Load(query);
XmlNamespaceManager manager = new XmlNamespaceManager(wData.NameTable);
manager.AddNamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0");
XmlNode channel = wData.SelectSingleNode("rss").SelectSingleNode("channel");
XmlNodeList nodes = wData.SelectNodes("/rss/channel/item/yweather.forecast", manager);
Temperature = channel.SelectSingleNode("item").SelectSingleNode("yweather:condition", manager).Attributes["temp"].Value;
Condition = channel.SelectSingleNode("item").SelectSingleNode("yweather:condition", manager).Attributes["text"].Value;
Humidity = channel.SelectSingleNode("yweather:atmosphere", manager).Attributes["humidity"].Value;
Visibility = channel.SelectSingleNode("yweather:atmosphere", manager).Attributes["visibility"].Value;
Pressure = channel.SelectSingleNode("yweather:atmosphere", manager).Attributes["pressure"].Value;
Rising = channel.SelectSingleNode("yweather:atmosphere", manager).Attributes["rising"].Value;
Town = channel.SelectSingleNode("yweather:location", manager).Attributes["city"].Value;
State = channel.SelectSingleNode("yweather:location", manager).Attributes["region"].Value;
Windspeed = channel.SelectSingleNode("yweather:wind", manager).Attributes["speed"].Value;
Windchill = channel.SelectSingleNode("yweather:wind", manager).Attributes["chill"].Value;
TFCond = channel.SelectSingleNode("item").SelectSingleNode("yweather:forecast", manager).Attributes["text"].Value;
TFHigh = channel.SelectSingleNode("item").SelectSingleNode("yweather:forecast", manager).Attributes["high"].Value;
TFLow = channel.SelectSingleNode("item").SelectSingleNode("yweather:forecast", manager).Attributes["low"].Value;
Distance = channel.SelectSingleNode("yweather:units", manager).Attributes["distance"].Value;
Sunrise = channel.SelectSingleNode("yweather:astronomy", manager).Attributes["sunrise"].Value;
Sunset = channel.SelectSingleNode("yweather:astronomy", manager).Attributes["sunset"].Value;
Speed = channel.SelectSingleNode("yweather:units", manager).Attributes["speed"].Value;
BPressure = channel.SelectSingleNode("yweather:units", manager).Attributes["pressure"].Value;
Degrees = channel.SelectSingleNode("yweather:units", manager).Attributes["temperature"].Value;
Country = channel.SelectSingleNode("yweather:location", manager).Attributes["country"].Value;
}
です。これを使用するためには、
case "whats it like outside":
GetWeather();
Alexis.SpeakAsync("Currently it is, " + Condition + "with a high of " + Temperature + Degrees + ", there is a humidity of " + Humidity + "percent, and a windspeed of " + Windspeed + Speed);
break;
下に示すなど、あなたがそれを使用することができ、これは私のアプリでは、私が毎日使っている
string Temperature;
を追加します。だからこれはあなたに考えを与えるはずです。
あなたが提供したコードは、動作しないものを定義するには不十分です。ログインしてコードを表示し、現在のユーザーをフォームに表示する –
XMLテンプレートを表示できますか?そのファイルにはどのくらいのユーザー情報がありますか? –