I'm currently writing a web application that uses visual studios and c# and I'm fairly new to this area of coding. I'm having trouble starting with a user inputting a country the code will read from the url XML and display it out in a string format. Any help or examples would be highly appreciated.Thank you!
This is an example of the XML that I want to read where q=(yourcountry)is a user input that I will set up in a textbox
https://samples.openweathermap.org/data/2.5/weather?q=(your country) &mode=xml&appid=b6907d289e10d714a6e88b30761fae22
-edit I have tried this code but I get an Error
I'm trying to extract the temperature from this URL and output to a label but I get an Error that is just loading when i press my submit button is there anything wrong with my code?
String country = TextBox1.Text;
XmlDocument doc1 = new XmlDocument();
doc1.Load(("http://api.openweathermap.org/data/2.5/weather?q="+country+"&mode=xml&APPID=*CHANGEDAPPID*"));
XmlElement root = doc1.DocumentElement;
XmlNodeList nodes = root.SelectNodes("/response/current_observation");
foreach (XmlNode node in nodes)
{
string temperaturev = node["temperature.value"].InnerText;
Label1.Text = temperaturev;