2
XML 데이터를 구문 분석하는 동안 오류가 발생 : 나는 루트 수준에서 제외 * 데이터를 얻고나는 아래와 같은 구글 날씨 데이터를 얻으려고 노력했다
try
{
string cityName = txtCityName.Text;
//Format the google URL with CityName
string weatherURL = string.Format("http://www.google.com/ig/api?weather={0}", cityName);
//Parse the XML URL and get the Data
var weatherXML = XDocument.Parse(weatherURL);
var weatherResult = from weatherDetail in weatherXML.Descendants("current_conditions")
select new currentWeatherCondition
{
condition = ((string)weatherDetail.Element("condition").Attribute("data")).Trim(),
temp = ((string)weatherDetail.Element("temp_c").Attribute("data")).Trim(),
imageURL = ((string)weatherDetail.Element("icon").Attribute("data")).Trim(),
};
}
catch (Exception err)
{
Response.Write(err.Message.ToString());
}
잘못되었습니다. 1 행, 1 위치. * XML 데이터를 전달하지 않고 URL을 전달할 때 *. 어떻게