这就是我到目前为止所拥有的.我试图从URL读取XML,并获得例如温度,湿度......等等.但每次我尝试别的东西它都会给我一个错误.我想检索信息并将其放在标签中.
namespace WindowsFormsApplication1 {
public partial class Form1: Form {
public Form1() {
InitializeComponent();
}
private void btnSubmit_Click(object sender, EventArgs e) {
String zip = txtZip.Text;
XmlDocument weatherURL = new XmlDocument();
weatherURL.Load("http://api.wunderground.com/api/"
your_key "/conditions/q/" + zip + ".xml");
foreach(XmlNode nodeselect in weatherURL.SelectNodes("response/current_observation"));
}
}
}
Run Code Online (Sandbox Code Playgroud)