I want to use the RSS2 extensions feature to add my own non-standard elements to my RSS feed as described here:
http://cyber.law.harvard.edu/rss/rss.html#extendingRss:
However I don't think that the .Net Rss20FeedFormatter class supports this feature.
My code looks something like this:
public Rss20FeedFormatter GetRSS()
{
var feed = new SyndicationFeed(....);
feed.Items = new List<SyndicationItem>();
// add items to feed
return new Rss20FeedFormatter(feed);
}
If it doesn't support it is there any alternative to just creating the XML element by element?
Here's my findings. Took me a while to figure it all out.
This is what you do, your feed has to have a namespace
Your items need to be a derived class, and you write the extended properties in WriteElementExtensions, making sure you prefix them with the namespace (you don't have to but this is what is required to make it valid RSS).
The extended properties are ignore if you look in an RSS reader such as firefox, you'll need to write code to read them as well.
The url http://www.yoursite.com/someurl doesn't have to exist, but you need it to define the namespace and make the RSS valid. Normally you'll just put a page there which says something about what the feed should look like.