Parsing XML in Windows Phone 7
Let's go back to the application that we are building in Visual Studio. First, change siteUrl
in the MainPage.xaml.cs
file to the RSS Feed URL that we got from our list.
private string siteUrl = "http://ssps2010/chapter6/_layouts/listfeed.aspx?List=%7BD45848A1%2D12E8%2D4722%2DAB5B%2D511BF802F8D8%7D&Source=http%3A%2F%2Fssps2010%2Fchapter6%2FLists%2FEngineering%2520Notes%2FAllItems%2Easpx";
Now, rerun the application in the emulator and the raw XML from the RSS feed will appear in the text block. Now that we have the XML feed in a string, we should display it in a more meaningful way. To do that, let's do the following:
1. Replace the text block display with a listbox
2. Create a simple view model for an RSS Item
3. Parse the XML
4. Create a list of RSS Items
5. Bind the list of RSS Items to the listbox
Sounds simple, right? Before we begin though, a quick word about a term we used in step 2. Although we are going to create a view model that will hold each RSS...