News Feed using RSS

News Feed using RSS
News feed using RSS

Creating news articles is probably the one thing that really pushed RSS to its popularity. News in its basic definition is to inform and educate based on facts. Now that is not to say the news sometimes has opinions added to the mix. Either way, the electronic masses needed to get their articles out in a way for all to read and to get them when they were published. Enter RSS.

Using RSS to feed news is one of the most easiest ways to inform your readers of what is going on. As mentioned in my previous articles, you may want to build a front end interface, using ASP of course, to enter your news articles into your database. Having this front end will allow you to easily enter any new articles and not have to worry about getting into the database to enter them manually.

There are two parts to creating the RSS feed.

The header and the body. The header consist of some basic RSS code to format the feed correctly so that is can be read and processed by the readers. (You can get a free one from The body will include the information that is pulled from the database.

Here is how the header will always look:

<?xml version="1.0"

<% Response.Buffer = true
Response.ContentType = "text/xml"
Function ApplyXMLFormatting(strInput)
if len(strInput) > 0 then
strInput =
Replace(strInput,"&", "&")

strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""",

strInput = Replace(strInput, ">",

strInput = Replace(strInput,"<","<")
strInput = ""
end if
ApplyXMLFormatting = strInput
End Function

Again, this will make sure that the RSS Reader can read the file correctly. The next piece is the body which will process the news records from the database. As long as you have the fields setup in the database, you should be good to go. (

The body of the file can look like this:

<rss version="2.0">
<title>RSS Job Board -

<description>RSS Job Board for
ASP Developers</description>


<title>ASP @</title>
Dim objConn
Set objConn =

Set objRS =

objConn.ConnectionString =

"Provider=sqloledb;Data Source=DBSERVER;Initial Catalog=ARTICLEDB;User Id=sa;Password=sqlpassword;"

objConn.CursorLocation = 3
Dim objRS, strSQL, strDesc
WHERE (DateAdded <= '" & Now() & "') order by DateAdded DESC"

objRS.Open strSQL, objConn

Do While Not objRS.EOF
strDesc = "<b>Job Posted by " &
objRS("Owner") & " on " & _

objRS("DateAdded") & "
PST</b><br>" & _



(Christopher Combs)</webMaster>

Set objRS = Nothing
Set objConn = Nothing
Then save the file as an ASP or an RSS. (RSS making sure you have setup your server to accept RSS file requests as ASP –

If you have problems or questions regarding this or any other article, please let me know.

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2023 by Christopher Combs. All rights reserved.
This content was written by Christopher Combs. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.