showRss()

‘*************************************************
‘过程名:showRss
‘作 用:显示RSS
‘参 数:通过request获取两个参数ID–Rss编号,feedurl–RSS路径
‘返回值:无
‘*************************************************
sub showRss()
dim RssId,htc
RssId=trim(Request(“ID”))
htc=updateRSSHtc(RssId,”1″)

Dim feedurl
feedurl=Trim(Request(“feedurl”))
If feedurl=”” Then
response.Write(“<form method=post action=””””>”)
response.Write(“RSS地址:<input type=””text”” name=””feedurl”” size=””30″”><input type=””submit”” value=””我要阅读””></form>”)

else
Set http=Server.CreateObject(“Microsoft.XMLHTTP”)
http.Open “GET”,feedurl,false
http.send

Set xml=Server.CreateObject(“Microsoft.XMLDOM”)
xml.Async=False
xml.ValidateOnParse=False
xml.Load(http.ResponseXML)

Set xsl=Server.CreateObject(“Microsoft.XMLDOM”)
xsl.Async=False
xsl.ValidateOnParse=False
xsl.Load(server.MapPath(“rss.xsl”))
dim strTemp
strTemp=xml.transformNode(xsl)
strTemp=replace(strTemp,”&lt;”,”<“)
strTemp=replace(strTemp,”&gt;”,”>”)
strTemp=replace(strTemp,”&amp;”,”&”)

strTemp=replace(strTemp,”[$m_htc$]”,htc)’instr(strTemp,”$m_htc”)
response.Charset=”utf-8″
response.Write strTemp
‘if xml.ReadyState>2 and xsl.readystate>2 then
‘response.Write xml.transformNode(xsl)

‘end if

‘If xml.ReadyState>2 Then
”Response.Write(“文档已经准备就绪。状态:”& xml.ReadyState &”<br>”)
‘title = xml.selectsinglenode(“//title”).text
‘url = xml.selectsinglenode(“//link”).text
‘Response.Write(“<a href=”””& url&”””>”& title &”</a><br><br>”)
‘Response.Write(xml.selectsinglenode(“//description”).text&”<br><br>”)
‘Set item=xml.getElementsByTagName(“item”)
‘For i=0 To (item.Length-1)
‘Set title=item.Item(i).getElementsByTagName(“title”)
‘Set link=item.Item(i).getElementsByTagName(“link”)
‘Set pubDate=item.Item(i).getElementsByTagName(“pubDate”)
‘Set description=item.Item(i).getElementsByTagName(“description”)
‘Response.Write(“<a href=”””& link.Item(0).Text &”””>”& title.Item(0).Text& “</a><br>”)
‘Response.Write(pubDate.Item(0).Text&”<br>”)
‘Response.Write(description.Item(0).Text&”<br>”)
‘Response.Write(“====================================================================================<br>”)
‘Next
‘Else
‘Response.Write(“文档还未准备就绪。状态:”& xml.ReadyState&”<br>”)
‘End If
Set http=Nothing
Set xml=Nothing
End If
end sub

« »