atom2rss.asp
程序员文章站
2023-11-07 12:10:52
复制代码 代码如下:<% ' atom2rss.asp ' author: francesco passantino '&nb...
复制代码 代码如下:
<%
' atom2rss.asp
' author: francesco passantino
' email: francesco@iteam5.net
' blog: www.iteam5.net/blog
' start date: 17 sep 2004
sub atom2rss(url)
set objxml = server.createobject("msxml2.domdocument.3.0")
objxml.async = false
objxml.setproperty "serverhttprequest", true
objxml.validateonparse = true
objxml.preservewhitespace = false
if not objxml.load(url) then
response.write "<p>error<br>code: " & _
objxml.parseerror.errorcode & _
"<br>linea/col: " & _
objxml.parseerror.line & "/" & _
objxml.parseerror.linepos & "</p>"
else
rsstitle="iteam5.net/blog"
rssdescription="blog sulle novit?del settore information & communication technologies"
rsslink="http://www.iteam5.net/blog"
rsslanguage="it"
xml= "<?xml version=""1.0"" encoding=""utf-8""?><rss version=""0.91""><channel><title>"&server.htmlencode(rsstitle)&"</title><description>"&server.htmlencode(rssdescription)&"</description><link>"&server.htmlencode(rsslink)&"</link><language>"&server.htmlencode(rsslanguage)&"</language>"
set objnodelist = objxml.getelementsbytagname("entry")
for each objnode in objnodelist
for each objnode2 in objnode.childnodes
select case objnode2.nodename
case "issued"
strdate= left(objnode2.firstchild.nodevalue,10)
case "link"
strurl = objnode2.getattribute("href")
case "title"
strtitle = objnode2.firstchild.nodevalue
'instead of case "content"
case "summary"
strdescription = objnode2.firstchild.data
for each objnode3 in objnode2.childnodes
select case objnode3.nodename
case "div"
strdescription = objnode3.text
for each objnode4 in objnode3.childnodes
select case objnode4.nodename
case "a"
linkable=objnode4.firstchild.text
htmlink=" <a href='"& _
objnode4.getattribute("href")&"'>"& _
linkable&"</a>"
strdescription = replace(strdescription,linkable,htmlink)
end select
next
end select
next
end select
next
xml= xml & "<item>"
xml=xml & "<title><![cdata[" & server.htmlencode(strtitle) & "]]></title>"
xml=xml & "<description><![cdata[" & server.htmlencode(strdescription) & "]]></description>"
xml=xml & "<link><![cdata[" & server.htmlencode(strurl) & "]]></link></item>"
strtitle = ""
strurl = ""
strdescription = ""
next
xml = xml & "</channel></rss>"
response.contenttype = "text/xml"
response.write xml
set objnodelist = nothing
end if
end sub
call atom2rss("http://www.iteam5.net/blog/feed.xml")
%>
上一篇: 各地秋分习俗?秋分节气要吃什么?
下一篇: 樱桃怎么保存,放在纸盒子里保鲜效果好
推荐阅读