1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| Response.ContentType = "text/xml" Set xmlPars = Server.CreateObject("Msxml2.DOMDocument")
Set rss = xmlPars.CreateElement("rss") rss.setAttribute "version", "2.0" rss.setAttribute "xmlns:dc", "http://purl.org/dc/elements/1.1/" rss.setAttribute "xmlns:sy", "http://purl.org/rss/1.0/modules/syndication/" rss.setAttribute "xmlns:admin", "http://webns.net/mvcb/" rss.setAttribute "xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlPars.AppendChild(rss)
Set Channel = xmlPars.CreateElement("channel") rss.AppendChild(Channel)
Set title = xmlPars.CreateElement("title") Channel.AppendChild(title) Channel.childnodes(0).text = "사이트명(체널제목으로 들어가는 부분)"
Set channel_link = xmlPars.CreateElement("link") Channel.AppendChild(channel_link) Channel.childnodes(1).text = "사이트의 도메인 혹은 체널제공 카테고리의 메인주소"
Set description = xmlPars.CreateElement("description") Channel.AppendChild(description) Channel.childnodes(2).text = "사이트 설명"
Set language = xmlPars.CreateElement("dc:language") Channel.AppendChild(language) Channel.childnodes(3).text = "ko"
objconn = "Provider=SQLOLEDB; Data Source=DB주소; Initial Catalog=DB명; User ID=아이디; Password=비밀번호;" SQL = "select top 50 필드1, 필드2 … " SQL = SQL & " , 필드x, 필드y …" SQL = SQL & " from 테이블명 " SQL = SQL & " where 조건 " SQL = SQL & " order by 어쩌구 desc " set rs = Server.CreateObject("ADODB.Recordset") rs.Open SQL,objconn,3
Do until rs.EOF
Set item = xmlPars.CreateElement("item") Channel.AppendChild(item)
set title = xmlPars.CreateElement("title") set link = xmlPars.CreateElement("link") set description = xmlPars.CreateElement("description") set dcdate = xmlPars.CreateElement("dc:date") set dcsubject = xmlPars.CreateElement("dc:subject") item.AppendChild(title) item.AppendChild(link) item.AppendChild(description) item.AppendChild(dcdate) item.AppendChild(dcsubject) item.childnodes(0).text = "1개의 포스트(게시글)의 제목" item.childnodes(1).text = "고유 주소" item.childnodes(2).text = "본문내용" item.childnodes(3).text = "등록일" item.childnodes(4).text = "카테고리 혹은 분류할 수 있는 테그명 등…" rs.movenext loop
Response.Write xmlPars.xml rs.close set rs = nothing Set xmlPars = nothing
|