HomeWeb HostingReseller Web HostingDedicated ServerResources & Support
 

HOW TO CONVERT RSS DATA INTO HTML FORMAT USING ASP.NET

In today’s era RSS files are used in many applications because RSS files are actually XML file which can run on any platform and can be changed easily. Many of you may be aware that ASP.NET provides XML classes which are very useful in many applications.

 

To convert any RSS file into HTML format you have to use one namespace provided by ASP.NET which is:

 

 System.Xml.

 

 

After importing required namespace you will have access of all the classes which are coming under this namespace. As a first step, create the object of XmlDocument class.

 

Dim xmldoc1 As New XmlDocument

 

 

After creating object of this class use the load method of this class and pass the RSS file as a parameter for this method.

 

xmldoc1.Load( any RSS File comes here as argument)

 

 

after completing above steps create the object of XmlNodeList class

 

Dim xmlnodelist As XmlNodeList and assign value to this object which would be the text of any tag whose data you want to covert in HTML format and for that you have to use ‘GetElementByTagName’ method of XmlDocument class.

 

xmlnodelist = xmldoc1.GetElementsByTagName("item") but to access data of any particular node you have to create an object of  another class which is XmlNode.

 

Dim xmlnode As XmlNode

 

 

Now, assign value to this object, which you can be done by using the item method of XmlNodeList class and as a parameter, the user have to pass integer value which will indicate that which feed you want to convert in HTML format.

 

xmlnode = xmlnodelist.Item(0)

 

 

By this way, you can convert any one RSS feed into HTML format but if you want to convert all the RSS feeds into HTML format than you have to use any of the looping method to access all RSS feeds and generally for this FOR loop is a better way as per my suggestion.

 

Now to access available data between that tags you have to use one more method of XmlNode class which is InnerText and which will fetch the data of that tag. It will display the data to you and just store it in a string variable because that method returns string value only. You can use any available method as per the requirements and suitability to your application. Here I have created one string variable:

 

Dim str As String

 

str = xmlnode.InnerText

 

 

Finally, you can use this variable to print the output on the screen.

 


(Posted By Aden on Tuesday, May 02, 2006)

 Read All Stories
 

 
   
 
 
» Host multiple domains in one plan
» Manage all your domains in one control panel
» Both Windows and Linux Options
» Windows Plans starting at $9.95 per month
» Linux Plans starting at $6.95 per month
» Windows Plan: MS SQL 2005 Database Included
 
Window Plans   Linux Plans
 
Close  

Copyright 2003 - 2007 All rights reserved Accu Web Hosting