I am creating a small RSS Reader application.
The code I am using to get the xml is as follows:
void PhonePage1_Loaded(object sender, RoutedEventArgs e)
{
WebClient wc = new WebClient();
wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
wc.OpenReadAsync(new Uri("http://www.benchmark.pl/rss/aktualnosci-pliki.xml"));
}
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
SyndicationFeed feed;
using (XmlReader reader = XmlReader.Create(e.Result))
{
feed = SyndicationFeed.Load(reader);
NewsFeed.ItemsSource = feed.Items;
}
}
The problem is that the SyndicationFeed item template does not fit the template in the xml file. I somehow need to edit the template so that the text is inserted correctly. How can I do that?
By using the
SyndicationFeedyou’ll have to use the objects it defines. It would, however, be easy to convert this to something that more closely reflects your XML.Assuming you had a class like:
You could convert the SyndicationFeed items to it like: