生成RSS
<%
Response.Clear
Response.CharSet="gb2312" '数据集
Response.ContentType="text/xml" '数据流格式定义
Response.Write "<?xml version=""1.0"" encoding=""gb2312""?>"&vbNewLine
sRssHead = "<rss version='2.0'>" & vbNewLine
sRssHead = sRssHead & "<channel>" & vbNewLine
sRssHead = sRssHead & "<title>xx网</title>" & vbNewLine
sRssHead = sRssHead & "<description>xx新闻更新</description>" & vbNewLine
sRssHead = sRssHead & "<link>http://www.xxcom/</link>" & vbNewLine
sRssHead = sRssHead & "<language>zh-cn</language>" & vbNewLine
sRssHead = sRssHead & "<docs>xx网新闻更新</docs>" & vbNewLine
sRssHead = sRssHead & "<generator>Rss Generator By 养殖网</generator>" & vbNewLine
sRssEnd = "</channel></rss>"
response.write sRssHead
set cn=server.createobject("adodb.connection")
cn.open connstr
set rs=server.createobject("adodb.recordset")
rs.open "select top 20 title,c_filename,writefrom,date from wz_list where lanmuid=21 order by id desc",cn,1,1
while not rs.eof
%>
<%="<item><title>"&rs("title")&"</title><link>http://www.yangzhi.com/news/"&rs("c_filename")&"</link><author>"&rs("writefrom")&"</author><pubDate>"&rs("date")&"</pubDate></item>"%>
<%
rs.movenext
wend
rs.close
set rs=nothing
cn.close
set cn=nothing
response.write sRssend
%>
讀取RSS
Function readrss(xmlseed)
dim xmlDoc
dim http
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET",xmlseed,False
http.send
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.Async=False
xmlDoc.ValidateOnParse=False
xmlDoc.Load(http.ResponseXML)
Set item=xmlDoc.getElementsByTagName("item")
if item.Length<=0 then
Response.Write("[Nothing]")
else
Response.Write("<ul style=""margin-left:15px; list-style-type:square;font-size:12px;line-height:20px;"">")
For i=0 To (item.Length-1)
Set title=item.Item(i).getElementsByTagName("title")
Set link=item.Item(i).getElementsByTagName("link")
Response.Write("<li><a href="""& link.Item(0).Text &""" target=""_blank"">"& title.Item(0).Text &"</a></li>")
Next
Response.Write("</ul>")
end if
set item=nothing
set xmlDoc=nothing
set http=nothing
End Function
----////call readrss("http://2008.67ge.com/feed")
http://baike.baidu.com/view/1644.htm
申明
非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!