Click here to Skip to main content
15,884,353 members
Articles / Programming Languages / Visual Basic
Tip/Trick

Quick RSS

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
14 Mar 2013CPOL 9.1K   2  
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)


Written By
Student
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --