atom2rss.asp_ASP教程-查字典教程网
atom2rss.asp
atom2rss.asp
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:xml=xml&""xml=xml&""strTitle=""strURL=""strDescription=""Next...

复制代码 代码如下:

<%

'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")

%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类