sampleRSSReader

<%
Dim feedurl
feedurl=Trim(Request.Form(“feedurl”))
If feedurl=”” Then
%>
<form method=post action=””>
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)
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
%>

« »