atom2rss.asp

來源:互聯網
上載者:User

複製代碼 代碼如下:<%
' 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")

%>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.