Click here to Skip to main content
15,887,267 members
Articles / Web Development / ASP.NET
Article

RSS feed in ASP script

Rate me:
Please Sign up or sign in to vote.
1.29/5 (7 votes)
12 Jan 2005 29.5K   18   1
Very simple RSS feed script in ASP

Introduction

very simple

edit your own SQL exec yourself in this code

by Zion,  udanax@msn.com

sample : http://localhost/xrss.asp?FeedID=ifm_id

 

<BR><?xml version="1.0" encoding="EUC-KR" ?><BR><%<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>'2004 code by udanax.msn.com<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>Dim FeedID,Conn,rs,SQL,rs2, tt, cc, rr<BR> FeedID = Request("FeedID")<BR> <BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>set Conn = Server.CreateObject("ADODB.connection")<BR> Conn.Open gsInfoMailConnStr<BR>     SQL = "select top 1 b.sendpage_id, a.ifm_title, a.ifm_intro, a.ifm_id from ifm_info" <BR>     SQL += "a inner join ifm_sendpage_info b on a.ifm_id = b.ifm_id inner join ifm_sendpage_contents_info c on b.sendpage_id = c.sendpage_id" <BR>     SQL += "where a.ifm_id = '"&FeedID&"'"<BR>      <BR> set rs2 = Conn.Execute(SQL)<BR>       tt = rs2("ifm_title")<BR>       cc = rs2("ifm_intro")<BR>       rr = rs2("ifm_id")  <BR> rs2.close<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>Response.ContentType = "text/xml" <BR><BR><BR>      Set xmlPars = Server.CreateObject("Msxml2.DOMDocument")<BR>       Set rss = xmlPars.CreateElement("rss")<BR>        rss.setAttribute "version", "2.0" <BR>        rss.setAttribute "xmlns:dc", "<A href="http://purl.org/dc/elements/1.1/">http://purl.org/dc/elements/1.1/</A>" <BR>        rss.setAttribute "xmlns:sy", "<A href="http://purl.org/rss/1.0/modules/syndication/">http://purl.org/rss/1.0/modules/syndication/</A>" <BR>        rss.setAttribute "xmlns:admin", "<A href="http://webns.net/mvcb/">http://webns.net/mvcb/</A>" <BR>        rss.setAttribute "xmlns:rdf", "<A href="http://www.w3.org/1999/02/22-rdf-syntax-ns">http://www.w3.org/1999/02/22-rdf-syntax-ns</A>#" <BR>       xmlPars.AppendChild(rss)<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''channel set start@<BR>       Set Channel = xmlPars.CreateElement("channel")<BR>           rss.AppendChild(Channel)<BR>       <BR>       Set title = xmlPars.CreateElement("title")<BR>           Channel.AppendChild(title)<BR>           Channel.childnodes(0).text = tt<BR>       <BR>       Set channel_link = xmlPars.CreateElement("link")<BR>           Channel.AppendChild(channel_link)<BR>           Channel.childnodes(1).text = "<A href="http://localhost/?ifm_id">http://localhost/?ifm_id</A>=" & rr<BR>       <BR>       Set description = xmlPars.CreateElement("description")<BR>           Channel.AppendChild(description)<BR>           Channel.childnodes(2).text = cc<BR>       <BR>       Set language = "xmlPars.CreateElement(""dc:language")<BR>           Channel.AppendChild(language)<BR>           Channel.childnodes(3).text = "ko"<BR><BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''db query<BR>SQL = "select top 8 b.sendpage_id, a.ifm_title, a.ifm_intro, a.ifm_id, b.sendpage_title, a.user_id, a.chat_id, c.sendpage_contents, b.regdate"  <BR>SQL += "from ifm_info a inner join ifm_sendpage_info b on a.ifm_id = b.ifm_id inner join ifm_sendpage_contents_info c on b.sendpage_id = c.sendpage_id" <BR>SQL += "where a.ifm_id = '"&FeedID&"' order by regdate desc"<BR>set rs = Conn.Execute(SQL)<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''loop<BR>Do until rs.EOF <BR><BR>   Set item = xmlPars.CreateElement("item")<BR>   Channel.AppendChild(item)<BR>   <BR>       set title = xmlPars.CreateElement("title") <BR>       set link = xmlPars.CreateElement("link")<BR>       set description = xmlPars.CreateElement("description")<BR>       set dcdate = xmlPars.CreateElement("dc:date")<BR>       set dcsubject = xmlPars.CreateElement("dc:author")<BR>    <BR>       item.AppendChild(title)<BR>       item.AppendChild(link)<BR>       item.AppendChild(description)<BR>       item.AppendChild(dcdate)<BR>       item.AppendChild(dcsubject)<BR>    <BR>       item.childnodes(0).text = rs("sendpage_title")<BR>       item.childnodes(1).text = "<A href='http://localhost/?ifm_id="&rr&"&sendpage_id'>http://localhost/?ifm_id="&rr&"&sendpage_id</A>=" & rs("sendpage_id")<BR>       item.childnodes(2).text = rs("sendpage_contents")<BR>       item.childnodes(3).text = rs("regdate")<BR>       item.childnodes(4).text = rs("chat_id")<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>rs.movenext<BR>loop<BR><BR>Response.Write xmlPars.xml<BR>rs.close<BR>set rs = nothing<BR>Set xmlPars = nothing<BR>%><BR><BR>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer NHN, corp.
Korea (Republic of) Korea (Republic of)
My name is Edward J. Yoon (윤진석), a worker for the NHN, cop. I'm also a founder/developer of the Apache Hama project which is Parallel Matrix Computational Package, and Apache Hadoop.

Comments and Discussions

 
QuestionWhere's the article? Pin
mav.northwind13-Jan-05 2:13
mav.northwind13-Jan-05 2:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.