469,575 Members | 1,651 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Trouble with rss2html.asp

I am primarily a front-end designer and not familiar with ASP beyond
breaking up pages into include files. Recently, one of my freelance
clients wanted to display an RSS feed from his blog on his site. I did
some research and found the rss2html.asp script. I chose this over a
javascript solution because those scripts apparently don't affect
search engine rankings.

I implemented the script and it was running fine until about a month
ago, when the site and sometimes the server running it started to
crash. The ISP and the blog company the RSS feed originates from blame
the script. Bytescout, who wrote the script, says that it's probably
the feed that's causing the problem. The RDF version of the feed
validates as RSS, but the ATOM one has specs that are too new for the
validator to parse correctly.

I'm inclined to think that the way I implemented the script is causing
the problem. I'll post it below:

<%
' =========== RSS2HTML.ASP for ASP/ASP.NET ==========
' copyright 2005 (c) www.Bytescout.com
' ===============================================

' =========== configuration =====================
' ##### URL to RSS Feed to display #########
'URLToRSS = "http://rssnewsapps.ziffdavis.com/tech.xml"
'URLToRSS =
"http://stopyouranger.typepad.com/anger_in_the_news/atom.xml"
'URLToRSS =
"http://stopyouranger.typepad.com/anger_in_the_news/index.rdf"
'URLToRSS = "http://www.ajnovickgroup.com/weblog/atom.xml"
'URLToRSS = "http://www.rssmix.com/u/4592/rss.xml"
URLToRSS = "http://www.feedjumbler.com/ea511d86/rss.xml"

' ##### max number of displayed items #####
MaxNumberOfItems = 7

' ##### Main template constants
MainTemplateHeader = "<ul class=""leftnav"">"
MainTemplateFooter = "</ul>"
' #####

' ##### Item template.
' ##### {LINK} will be replaced with item link
' ##### {TITLE} will be replaced with item title
' ##### {DESCRIPTION} will be replaced with item description
ItemTemplate = "<li><a href=" & """{LINK}""" & ">{TITLE}</a></li>"

' ##### Error message that will be displayed if not items etc
ErrorMessage = "<p>Feed temporarily unavailable.<br /> Please try
again later.</p>"

' ================================================

Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0")
xmlHttp.Open "Get", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText

Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
xmlDOM.async = false
xmlDOM.LoadXml(RSSXML)

Set xmlHttp = Nothing ' clear HTTP object

Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all
"items" from downloaded RSS
Set xmlDOM = Nothing ' clear XML

RSSItemsCount = RSSItems.Length-1

' writing Header
if RSSItemsCount > 0 then
Response.Write MainTemplateHeader
End If

j = -1

For i = 0 To RSSItemsCount
Set RSSItem = RSSItems.Item(i)

for each child in RSSItem.childNodes
Select case lcase(child.nodeName)
case "title"
RSStitle = child.text
case "link"
RSSlink = child.text
case "description"
RSSdescription = child.text
End Select
next

j = J+1

if J<MaxNumberOfItems then
ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)
ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)
Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription )
ItemContent = ""
End if

Next

' writing Footer
if RSSItemsCount > 0 then
Response.Write MainTemplateFooter
else
Response.Write ErrorMessage
End If

' Response.End
%>

Can anyone tell me what's going on???

Thanks,

--keith

Aug 4 '05 #1
0 1798

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jacek Dziedzic | last post: by
reply views Thread by Alexandre Jaquet | last post: by
1 post views Thread by Jim Bancroft | last post: by
6 posts views Thread by Daniel Walzenbach | last post: by
reply views Thread by mrchatgroup | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.