Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Quick RSS

0.00/5 (No votes)
14 Mar 2013CPOL 9.3K  
Quick way to read RSS

Introduction

In .NET 3.5, the class SyndicationFeed was introduced. We can use that to read/create RSS2 and Atom 1.0 feeds. In this tip, the class is used to develop a RSS reader.

Using the Code

Import System.Xml and  System.ServiceModel.Syndication in your RSS Reader class. 

VB.NET
Dim feedurl As String = "http://feeds.feedburner.com/cnet/NnTv"
Dim reader As XmlReader = XmlReader.Create(feedurl)
Dim feed As SyndicationFeed = SyndicationFeed.Load(reader)

txtFeed.Text = txtFeed.Text & vbCrLf & feed.Title.Text

For Each item As SyndicationItem In feed.Items
    txtFeed.Text = txtFeed.Text & vbCrLf & item.Title.Text
Next  

The above code shows a simple implementation. txtFeed is a text box where the details of the feed are displayed.

The same definitions work for C#. 

Reference

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)