65.9K
CodeProject is changing. Read more.
Home

Quick RSS

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Mar 14, 2013

CPOL
viewsIcon

9271

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. 

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