Monday, 27 July 2009

OpenNETCF.Rss and SDF 2.3

A question was asked on the MSDN Smart Device Development Forum this morning regarding Synchronization using RSS ( I responded with a number of links to the OpenNETCF's SDF documention for their RSS namespace and a link to Alex Yakhnin's blog post "Taking OpenNETCF.Rss for a spin." (

I am a keen subscriber to a number of blog posts via this mechanism so I have an interest in this, I even subscribe to various blogs on my HTC Diamond device, so I wanted to know more about this namespace. I didn't have much time this morning to have a play with Alex's example application so I had a look after work.

As the SDF now includes the OpenNETCF.Rss namespace I opened Alex's example and removed the OpenNETCF.Rss project and referenced the OpenNETCF.Rss namespace from the SDF2.3 installation on my machine. Building this then lead to a number of build errors relating to other changes in the SDF, I didn't really have time to correct all the build errors and all I really wanted to do was to prove that I could download some data via this mechanism so I started a new solution that would just download the name of the feed and the names of the feed items. I may come back to this and correct the other build errors at some point.

I started writing some code however ran into a problem with a configuration I needed to provide, which Alex's example provided. After loading the config file into an XmlDocument I then proceeded extracting the relevant XmlNode and passing it to the StorageConfiguration.Load and TransportConfiguration.Load methods.

The second issue I came across was that the version of the OpenNETCF.Rss assembly was slightly out of date in Alex's config file so I updated it from to
All was going well, the config was loaded successfully, now all I needed to do was to call the Receieve method on a valid RSS feed URL. I tried my Twitter account however that requires additional user credentials, I then tried the MSDN forum however that didn't work (it didn't seem to work in Snackr either, but thats another story), I then tried Neil Cowburn's blog ( and that worked successfully.

I now have the title of the Feed in a label and the titles of the Feed Items in a listbox.

The following is the code I have :-

XmlDocument currentConfig = new XmlDocument();
currentConfig.Load(@"\Program Files\wmrsstester\WMRssTester.exe.config");
XmlNode currentNode = currentConfig.DocumentElement;
XmlNode feedNode = null;
foreach (XmlNode currentChildNode in currentNode.ChildNodes)
string nameofchildnode = currentChildNode.Name;
feedNode = currentChildNode;
OpenNETCF.Rss.Data.Feed currentFeed = OpenNETCF.Rss.FeedEngine.Receive(new Uri(@""));
this.label1.Text = currentFeed.Title;
foreach (OpenNETCF.Rss.Data.FeedItem currentFeedItem in currentFeed.Items)

Along with the config file :-

<?xml version="1.0" encoding="utf-8" ?><configuration> <configSections> <section name="" type="OpenNETCF.Rss.Configuration.FeedConfiguration, OpenNETCF.Rss, Version=, Culture=neutral, PublicKeyToken=null " /> </configSections>
<> <communication> <refreshInterval value="60000" /> <transports> <add scheme="http"> <defaultPort value="80" /> <receiveTimeout value="90000" /> <noDelay enabled="true" /> <connectionLimit inbound="16" /> <serializer type="OpenNETCF.Rss.FeedSerializer,Version=,Culture=neutral,PublicKeyToken=null" /> <hosts default="allow"> <allow /> <deny /> </hosts> </add> </transports> </communication>
<storage> <provider name="fileStorage" enabled="true" type="OpenNETCF.Rss.FeedFileStorage,OpenNETCF.Rss,Version=,Culture=neutral,PublicKeyToken=null"> <path value="\Temp" /> <feedSizeLimit value="250" /> </provider> </storage>

Hopefully this experience will help someone else.

First Blog Post

This is my first blog post. I will hopefully add a number of other posts as and when I think of something to write.