atom2rss.asp

2018-09-06 12:02

阅读:272

  复制代码 代码如下:
<%
atom2rss.asp
Author:FrancescoPassantino
Blog:
Startdate:17Sep2004


Subatom2rss(URL)
SetobjXML=Server.CreateObject(msxml2.DOMDocument.3.0)
objXML.async=false
objXML.setPropertyServerHTTPRequest,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=
rsslanguage=it

xml=<?xmlversion=1.0encoding=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
Caseissued
strdate=left(objNode2.firstChild.nodevalue,10)
Caselink
strURL=objNode2.GetAttribute(href)
Casetitle
strTitle=objNode2.firstChild.nodevalue

insteadofCasecontent
Casesummary

strDescription=objNode2.firstChild.data
ForEachobjNode3InobjNode2.childNodes
SelectCaseobjNode3.nodeName
Casediv
StrDescription=objNode3.text
ForEachobjNode4InobjNode3.childNodes
SelectCaseobjNode4.nodeName
Casea
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.writexml

setobjNodeList=Nothing

Endif
Endsub

callatom2rss(

%>


评论


亲,登录后才可以留言!