ATOM2RSS.ASP_ Application Skills

Source: Internet
Author: User
Tags cdata
Copy Code code as follows:

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

%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.