I am new to Windows Phone development, recently started to try to create a weather app, I am using API from World Weather Online (http://www.worldweatheronline.com/).
I retrieved the below sample data from the web site (http://free.worldweatheronline.com/f...key=xxxxxxxx):
I try to parse the xml and put them in a data class in C#. Below is my code:Code:<?xml version="1.0" encoding="UTF-8"?> <data> <request> <type>City</type> <query>Paris, France</query> </request> <current_condition> ....... </current_condition> <weather> ....... </weather> <weather> ....... </weather> </data>
This is my data class:Code:XDocument doc = XDocument.Parse(e.Result); var data1 = from q in doc.Descendants("result") select new RequestData { type = (string)q.Element("type"), query = (string)q.Element("query") }
But after the above codes executed, there is no error (good), but there is no data from the data1. I tried for doc.Descendants("current_condition) and doc.Descendants("weather") and I am able to get the data into the data1, only the doc.Descendants("result") didn't give me any result.Code:public class RequestData { public string type {get; set;} public string query {get; set;} }
Anyone know why? Thanks.

Reply With Quote

