Soren Winslow
Simple ASP RSS XML Data Feed Importer and Reader
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.
With a little bit of adjusting and knowing the fields of an incoming XML data feed, you can easily use this script for any XML data feed.
This is the base script that I am using for the Utah Jazz and San Diego Chargers photo pages.

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 "<a href=" & TheLink & ">" & _

                             "<b>" & TheTitle & "</b>" & _

                             "</a>" & _

                             "<br />"



              Response.Write TheDesc & _

                             "<br />"



              Response.Write TheDate & _

                             "<hr />"

           Next

        End If

     Set objItems = Nothing



  End If

Else

   Response.Write "There was an error retrieving the news feed"

End If



Set objXML = Nothing



               
© 1967 - 2017 Soren Winslow