This is an easy and simple ASP script that will import, read and display RSS data feeds.
It uses Microsoft.XMLDOM to import and process the code.
The way this code works, there is no need to use an external XSL style sheet since all the formatting
is done right within the script.
You can plug this script into any of your .asp pages for it to work.
Source: http://www.sorenwinslow.com/RSSAspCode.asp
Here is the code for the easy RSS/XML feed reader:
TheFeed = "http://www.amadirectlink.com/amadirectlink.xml"
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.Async = False
objXML.SetProperty "ServerHTTPRequest", True
objXML.ResolveExternals = True
objXML.ValidateOnParse = True
objXML.Load(TheFeed)
CellCount = 0
If (objXML.parseError.errorCode = 0) Then
Set objRoot = objXML.documentElement
If IsObject(objRoot) = False Then
Response.Write "There was an error retrieving the news feed"
Else
Set objItems = objRoot.getElementsByTagName("item")
If IsObject(objItems) = True Then
For Each objItem in objItems
On Error Resume Next
TheTitle = objItem.selectSingleNode("title").Text
TheLink = objItem.selectSingleNode("link").Text
TheDesc = objItem.selectSingleNode("description").Text
TheDate = objItem.selectSingleNode("pubDate").Text
Response.Write "" & _
"" & TheTitle & "" & _
"" & _
"
"
Response.Write TheDesc & _
"
"
Response.Write TheDate & _
"
"
Next
End If
Set objItems = Nothing
End If
Else
Response.Write "There was an error retrieving the news feed"
End If
Set objXML = Nothing

Post a Comment