This project has moved. For the latest updates, please go here.

Publishing a feed using RssDocument.ToXML

The weak-typed RssDocument class, as well as the strong-typed classed generated by the RssDll.exe command link compiler or the Build Provider include a ToXml method, which can be used to serialize and publish the feed:
public string ToXml(DocumentType outputType);

This method accepts a enum DocumentType argument that specifies what format the emitted XML should have. The options are listed:

To publish your feed as an Atom format feed from RssDocument, you can do the following inside an ASP.Net HttpModule or an HttpHandler:
string outputXml = rssDocument.ToXml(DocumentType.Atom); // Publish as Atom
XmlDocument document = new XmlDocument();
context.Response.ContentType = "text/xml";

As seen in the above sample code, you can decide the format of the output feed from the query-string. The default HttpHandler uses the outputtype query-string parameter and the values can be rss, rdf, atom or opml for the respective feed formats.

A sample of the feed emitted by the code above is shown here:

Last edited Jun 16, 2007 at 5:16 AM by IDisposable, version 2


tigermain Jun 29, 2009 at 12:12 PM 
This is a great project and I am implementing it in our open source MVC CMS. However I have one issue with this code, for some reason Firefox is displaying the source code with many illegal characters and therefore does not render the xml page, whilst IE seems to be able to read it properly.

Any ideas?