我收到此错误消息
找不到文件 <?xml version="1.0" encoding="UTF-8"?>
下面是代码。如何解决这个问题?感谢你的帮助。
rivate void button1_Click(对象发送者,RoutedEventArgs e) { string sPath = "http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"; WebClient wc = new WebClient(); wc.DownloadStringAsync(new Uri(sPath)); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); } void wc_DownloadStringCompleted(对象发送者,DownloadStringCompletedEventArgs e) { XDocument xdoc = XDocument.Load(e.Result); XElement locationElement = xdoc.Element("GeocodeResponse").Element("result").Element("geometry").Element("location"); 双纬度 = (double)locationElement.Element("lat"); 双经度 = (double)locationElement.Element("lng"); txtBlkLatLon.Text = latitude.ToString() + "," + longitude.ToString(); }