复制代码 代码如下:
<%
'atom2rss.asp
'Author:FrancescoPassantino
'Email:francesco@iteam5.net
'Blog:www.iteam5.net/blog
'Startdate:17Sep2004
Subatom2rss(URL)
SetobjXML=Server.CreateObject("msxml2.DOMDocument.3.0")
objXML.async=false
objXML.setProperty"ServerHTTPRequest",True
objXML.validateOnParse=true
objXML.preserveWhiteSpace=false
IfNotobjXML.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="Blogsullenovit?delsettoreInformation&CommunicationTechnologies"
rsslink="http://www.iteam5.net/blog"
rsslanguage="it"
xml="<?xmlversion=""1.0""encoding=""UTF-8""?><rssversion=""0.91""><channel><title>"&server.htmlencode(rsstitle)&"</title><description>"&server.htmlencode(rssdescription)&"</description><link>"&server.htmlencode(rsslink)&"</link><language>"&server.htmlencode(rsslanguage)&"</language>"
SetobjNodeList=objXML.getElementsByTagName("entry")
ForEachobjNodeInobjNodeList
ForEachobjNode2InobjNode.childNodes
SelectCaseobjNode2.nodeName
Case"issued"
strdate=left(objNode2.firstChild.nodevalue,10)
Case"link"
strURL=objNode2.GetAttribute("href")
Case"title"
strTitle=objNode2.firstChild.nodevalue
'insteadofCase"content"
Case"summary"
strDescription=objNode2.firstChild.data
ForEachobjNode3InobjNode2.childNodes
SelectCaseobjNode3.nodeName
Case"div"
StrDescription=objNode3.text
ForEachobjNode4InobjNode3.childNodes
SelectCaseobjNode4.nodeName
Case"a"
linkable=objNode4.firstChild.text
htmlink="<ahref='"&_
objNode4.GetAttribute("href")&"'>"&_
linkable&"</a>"
StrDescription=replace(StrDescription,linkable,htmlink)
endselect
next
endselect
next
EndSelect
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.writexml
setobjNodeList=Nothing
Endif
Endsub
callatom2rss("http://www.iteam5.net/blog/feed.xml")
%>