Tr3v.RSS

Tr3v.RSS is a .net class library. It has been designed to make creating RSS 2.0 feeds within .net applications easier.

Application reference »
Email Image
How do i use it?
Firstly, download and add a reference to the Tr3v.RSS.dll
using Tr3v.RSS;
C# Code
// Instantiate a new Channel.
Channel channel = new Channel("Tr3v RSS Feed", new Uri("http://tr3v.net/"), "Tr3v.net Blog Feed");

// Add a new Item to the Channel.Items collection.
channel.Items.Add(new Item("Tr3v RSS Feed 1", new Uri("http://tr3v.net"), "Tr3v.RSS Example 1"));

/* Then call the Save method to save the RSS Feed to an .xml file.*/
channel.SaveAs(new System.IO.FileInfo(@"c:\test.xml"));
XML Output from above example
<?xml version="1.0"?>
<rss version="2.0">
    <channel>
    <title>Tr3v RSS Feed</title>
    <link>http://tr3v.net/</link>
    <description>Tr3v.net Blog Feed</description>
    <generator>Tr3v.RSS</generator>
    <item>
        <title>Tr3v RSS Feed 1</title>
        <link>http://tr3v.net/</link>
        <description>Tr3v.RSS Example 1</description>
    </item>
</channel>
</rss>
To extend this, we could for example populate the Item properties from a database:
Channel channel = new Channel("Tr3v RSS Feed", new Uri("http://tr3v.net/"), "Tr3v.net Blog Feed");
try
{
    using (SqlConnection connection = new SqlConnection("your connection string"))
    {
        using (SqlCommand command = new SqlCommand("your SQL query", connection))
        {
            command.CommandType = CommandType.Text;
            command.Connection.Open();
            SqlDataReader dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                channel.Items.Add(new Item(dataReader["title"],
                                          new Uri(dataReader["link"]),
                                          dataReader["description"]);
            }
        }
    }
}
Email Addresses

The RSS 2.0 specification for displaying email addresses is "user@domain.com (Forename Surname)".

Tr3v.RSS fully supports this providing that when you set the email address, you set the display name.

...
item.Author = new System.Net.Mail.MailAddress("fred.flintstone@bedrock.com", "Fred Flintstone");
...

Will be output as

<item>
    ...
    <author>fred.flintstone@bedrock.com (Fred Flintstone)</author>
    ...
</item>
References
I used the following sites for reference when building this class library. If you want/need to go into more depth regarding RSS please read them.
http://www.rssboard.org
http://www.w3schools.com/rss/
http://validator.w3.org/feed/ - RSS feed validator, useful for checking your RSS output is valid.

Validation
Valid RSS Tr3v.RSS is designed to output valid RSS 2.0 compliant XML, to check your output, please use the validator linked above.

Version History
DateVersionNotes
07/04/20081.0.0.0Initial Build