There is a page . I need to take city id=" " и t /t from this page. How to implement it on c #?
1 answer
Here is a sample code:
var xmlPath = @"http://xml.weather.co.ua/1.2/forecast/23?dayf=5"; var doc = XDocument.Load(xmlPath); var city = doc.Descendants("city").First().Element("name").Value; var currentTemp = doc.Root.Element("current").Element("t").Value; Console.Write("Current temp in city {0} = {1}\r\n",city, currentTemp); |