Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my code is executed before the end of getting my xml?
    text
    copied!<p>i'm working on an windows 8 metro apps and i'm working on VS Ultimate.</p> <p>i succeded to get the XML on a webpage and i wanna parse it with LINQ to XML. when i do it with a local xml file, it is working but when i use the one i downloaded it is not. i tryed to debug it by printing the xml i got and it is correct. i think this is because of the asyncronous method we use to get the xml, the parsing start before the end of the extraction. is someone having a solution for me ? i checked a lot on internet but nothing was really helful. the code : </p> <pre><code>XDocument loadedData = new XDocument(); List&lt;Data&gt; listeData = new List&lt;Data&gt;(); var httpResponse = await new HttpClient().GetAsync("http://api.allocine.fr/rest/v3/search?partner=YW5kcm9pZC12M3M&amp;filter=movie,person&amp;count=1&amp;page=1&amp;q=avatar&amp;format=xml"); string sourceCode = await httpResponse.Content.ReadAsStringAsync(); XDocument doc = XDocument.Parse(sourceCode); listeData = (from query in doc.Descendants("movie") select new Data { OriginalTitle = (string) query.Element("originalTitle"), Title = (string) query.Element("title"), ProductionYear = (string) query.Element("productionYear"), Cover = (string) query.Element("cover"), Resume = (string) query.Element("resume") }).ToList(); var group1 = new SampleDataGroup("Group-1", "Tous Mes Films", "", "Assets/icone_groupe_all_movies.jpg", "Films sur le DD"); foreach (Data dataList in listeData) { group1.Items.Add(new SampleDataItem("Group-1-Item-1", dataList.Title, "", dataList.Cover, "", dataList.Resume, group1)); } this.AllGroups.Add(group1); </code></pre> <p>thank you so much guys !</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload