public IDictionary<String, String> getWeatherData(String lat, String lon)
{
XmlDataDocument doc = new XmlDataDocument();
IDictionary<String, String> data = new Dictionary<String, String>();
String url ="http://api.openweathermap.org/data/2.5/forecast/daily?lat=" + lat + "&lon=" + lon + "&cnt=5&mode=xml";
doc.Load(url);
XmlNodeList locationList = doc.GetElementsByTagName("location");
XmlNodeList foreCastList = doc.GetElementsByTagName("time");
data["City"] = locationList[0].SelectSingleNode("name").InnerText;
data["Country"] = locationList[0].SelectSingleNode("country").InnerText;
String temperature,wind,clouds;
for (int i = 0; i < 5; i++)
{
temperature = "Temperature : Morn = " + foreCastList[i].SelectSingleNode("temperature").Attributes["morn"].Value +
",Evening = " + foreCastList[i].SelectSingleNode("temperature").Attributes["eve"].Value + ",Night = " + foreCastList[i].SelectSingleNode("temperature").Attributes["night"].Value;
wind = "Wind : " + foreCastList[i].SelectSingleNode("windSpeed").Attributes["name"].Value;
clouds = "Clouds : " + foreCastList[i].SelectSingleNode("clouds").Attributes["value"].Value;
data[foreCastList[i].Attributes["day"].Value] = temperature + " | " + wind + " | " + clouds;
}
return data;
}