How to use NRss

To use NRss, add a reference to the NRss.dll file to the project and add a using directive for the namespaces NRss and NRss.Modules (the former is only needed if you want to read modules or you use a RssReader constructor that accepts a Module argument).

Reading a RSS file from disk

RssReader reader = new RssReader("rss.xml");
try
{
    Rss rss = reader.Read();
}
finally
{
    reader.Close();
}

Console.WriteLine(rss.Version);
Console.WriteLine(rss.Channel.Title);
Console.WriteLine("There are {0} items", rss.Channel.Items.Count);

Reading from a XmlTextReader

// create a XmlTextReader called xmlReader.
RssReader reader = new RssReader(xmlReader);
try
{
    Rss rss = reader.Read();
}
finally
{
    // closing the RSS reader also closes the XmlTextReader that was passed to the constructor.
    reader.Close();
}

Setting some options

// don't read any modules
// ignore alien (unknown, see documentation) elements and don't check that links begin with http:// or ftp://
RssReader reader = new RssReader("rss.xml", Module.None, RssReaderOptions.IgnoreAlienElements | RssReaderOptions.NoCheckLinks);
try
{
    Rss rss = reader.Read();
}
finally
{
    reader.Close();
}

Reading modules

// read the DublinCore module
RssReader reader = new RssReader("rss.xml", Module.DublinCore, RssReaderOptions.None);
try
{
    Rss rss = reader.Read();
}
finally
{
    reader.Close();
}

// note that rss.Channel.Modules.DublinCore will be null if there were no Dublin Core data in the channel
if (rss.Channel.Modules.DublinCore != null)
    Response.Write(rss.Channel.Modules.DublinCore.Creator);