http://api.met.no/weatherapi/locationforecast/1.9/?lat=49.8197202;lon=18.1673554 XMLで作業しようとしています。各温度要素のすべての値属性を選択したいとしましょう。
私はこれを試しました。
const string url = "http://api.met.no/weatherapi/locationforecast/1.9/?lat=49.8197202;lon=18.1673554";
WebClient client = new WebClient();
string x = client.DownloadString(url);
XmlDocument xml = new XmlDocument();
xml.LoadXml(x);
XmlNodeList nodes = xml.SelectNodes("/weatherdata/product/time/location/temperature");
//XmlNodeList nodes = xml.SelectNodes("temperature");
foreach (XmlNode node in nodes)
{
Console.WriteLine(node.Attributes[0].Value);
}
しかし、私はいつも何も得ません。私は何を間違っていますか?