当前位置: 首页 > 图文教程 > 网络编程 > ASP > atom2rss.asp

ASP
冒泡算法的三种JavaScript表示
asp无限分级(递归调用)
VBS、ASP代码语法加亮显示的类
安全脚本程序的编写 V1.0
atom2rss.asp
atom_js.asp
google sitemap.asp
用ASP读取/写入UTF-8编码格式的文件
捌度空间 缓存类
再来个专门为google量身定做的sitemap生成代码,(可是动态的哦)
一个能对访问者进行编号、记录访问次数、IP、时间的统计制作实例
如何在ASP页面动态Inclue文件?
多域名一网站时如果返回最原来的域名
网页木马代码例子(里面的文件是漏洞扫描器,呵呵)
ASP万用分页程序
ASP项目中的公共翻页模块
在ASP中使用均速分页法提高分页速度
3种不同的方法生成文件
身份证校验算法与ASP程序
ASP抽取数据的执行效率

ASP 中的 atom2rss.asp


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 30 ::
收藏到网摘: n/a

复制代码 代码如下:

<%
' atom2rss.asp
' Author: Francesco Passantino
' Email: [email protected]
' 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")
%>