꼭 블로그가 아니더라도 XML RSS 는 이제 어느정도 대세가 되어가고 있는 듯합니다. 이제는 언론사나 커뮤니티 등에서도 RSS 가 나옵니다.. 그리고 #Reader나 Xpyder,FreeDemon 등의 RSS 구독기 또한 점차 넓게 사용되고 있습니다. 여기서는 이러한 XML RSS 를 구현하는 방법을 ASP 기반에서 XML 컴포넌트를 이용하여 구현하고자 합니다.

사실 RSS 를 구현할때 사실 단순히 텍스트 파일로 뿌려주고 ContentType 만 xml 로 선언해줘도 가능합니다. 그러나 조금은 다르게 해보고 싶다는 저의 호기심도 있고, 확장성과 향후 유지보수에 조금이라도 더 손쉽게 하기위해서 윈도우즈 2000 에 기본제공되어 있는 XML 관련 컴포넌트를 이용하여 구현해보았습니다. 물론 아래 소스는 지금 제 블로그 RSS 의 원형이 되고 있습니다.

한가지 주의 하실점은 XML 선언전에 어떠한 개행( ) 이나 문자가 들어가서는 안됩니다. PHP 에서의 쿠키과 마찬가지 입니다.

< ?xml version="1.0" encoding="EUC-KR" ? >

< %
Response.ContentType = "text/xml"
Set xmlPars = Server.CreateObject("Msxml2.DOMDocument")

' 여기서 부터 rss 정보를 담는다.
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)

'< channel> 시작

Set Channel = xmlPars.CreateElement("channel")
rss.AppendChild(Channel)

'< title>정보
Set title = xmlPars.CreateElement("title")
Channel.AppendChild(title)
Channel.childnodes(0).text = "블로그 제목"

'< link>정보
Set channel_link = xmlPars.CreateElement("link")
Channel.AppendChild(channel_link)
Channel.childnodes(1).text = "블로그 주소"

'< description>정보
Set description = xmlPars.CreateElement("description")
Channel.AppendChild(description)
Channel.childnodes(2).text = "블로그 설명"

'< dc:language>정보
Set language = xmlPars.CreateElement("dc:language")
Channel.AppendChild(language)
Channel.childnodes(3).text = "ko"

'< image>정보
Set image = xmlPars.CreateElement("image")
Channel.AppendChild(image)

'이미지 정보에 들어갈 것들
set i_title = xmlPars.CreateElement("title")
set i_url = xmlPars.CreateElement("url")
set i_width = xmlPars.CreateElement("width")
set i_height = xmlPars.CreateElement("height")

image.AppendChild(i_title)
image.AppendChild(i_url)
image.AppendChild(i_width)
image.AppendChild(i_height)

image.childnodes(0).text = "이미지 제목"
image.childnodes(1).text = "이미지 경로"
image.childnodes(2).text = "이미지 가로 사이즈"
image.childnodes(3).text = "이미지 세로 사이즈"

' 여기서 부터는 포스트에 대해서 출력

' 우선 데이터를 읽어오자
SQL = "해당되는 포스트에 대한 쿼리문"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQL,접근문자열,adOpenForwardOnly,adLockPessimistic,adCmdText

' 여기서 부터 루프를 돌리자.
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 = rs("제목필드")
item.childnodes(1).text = rs("포스트 고유 url 필드")
item.childnodes(2).text = rs("내용 필드")
item.childnodes(3).text = rs("날짜 필드")
item.childnodes(4).text = rs("포스트의 분류 필드")

rs.movenext
oop

' 마지막으로 최종적으로 뿌려주자.
Response.Write xmlPars.xml

'마무리 ^^;

rs.close
set rs = nothing
Set xmlPars = nothing

% >
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/16 12:42 2007/06/16 12:42
Response
No Trackback , a comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2475

첫번째 방법은 Instant Client를 pc에 설치하고 명령프롬프트 창을 이용한다.

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html

오라클 공식 홈페이지에서 다운을 받는다.(가입을 해야됨)



▒ Instant Client Package - Basic
▒ Instant Client Package - SQL*Plus



1.위의 두가지 압축파일을 다운후 폴더를 하나 만들고 같은 폴더에 압축해제한 파일을 모아둔다.

2.Basic을 압축해제하면 oci.dll 이나오는대 이것을 C:\WINNT\SYSTEM32 폴더안에 복사시킨다.

3.파일을 모아둔 디렉토리를 환경변수의 PATH에 등록시킨다.

ex)C:\Ora\instantclient_10_2 이경로를 path에 등록

4.세팅이 끝났으면 시작->실행->cmd로 들어가서 sqlplus를 타이핑해본다.

5.사용자 인증 문자열의 구성은 다음과 같다.

Dos 창에서 다음처럼 서버에 접속합니다. ip는 임의의 ip를 사용했습니다.

C:\sqlplus username/password@mymachine.mydomain:port/service_name

C:\sqlplus dj01/dj01@123.123.100.32:1521/testdb.world

SQL>conn system/manager@123.123.100.32:1521/testdb.world



==============================================================================



두번째는 오라클서버와 연결된 웹서버의 isqlplus라는 솔루션을 이용하는것이다.

http://211.183.8.54/isqlplus (인터넷으로 오라클 접속하기)
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/16 12:00 2007/06/16 12:00
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2474

Window에서 Oracle Client 설치 및 기동

Step 1: Download the appropriate Instant Client packages for your platform. All installations REQUIRE the Basic package.

해당 플렛폼에 맞추어 Client를 다운받는다.

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html



Step 2: Unzip the packages into a single directory such as "instantclient".

다운받은 zip파일의 압축을 푼다.

(폴더명 이하: C:\WINDOWS\SYSTEM32\DRIVER\instantclient)


Step 3: Set the library loading path in your environment to the directory in Step 2 ("instantclient"). On many UNIX platforms, LD_LIBRARY_PATH is the appropriate environment variable. On Windows, PATH should be used.

시스템 환경변수를 설정하여준다.

기본 PATH에 추가: C:\WINDOWS\SYSTEM32\DRIVER\instantclient
환경변수 "TNS_ADMIN" 추가: C:\WINDOWS\system32\drivers\instantclient\
(TNS_ADMIN의 값은 Step4의 TNSNAMES.ORA파일의 위치를 지정한다.)


Step 4: TNSNAMES.ORA

환경변수 "TNS_ADMIN"에 지정한 폴더에 TNSNAMES.ORA파일을 생성한다.

파일내용===========================================
{tns-name} =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = {Oracle-server IP})(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = {schema-name})
)
)
===================================================


Step 5: ODBC config.

ODBC설정에서 사용자DNS를 추가한다.

추가 > Microsoft ODBC for oracle
데이터원본이름: 맘대로
설명: 맘대로
사용자이름: 접속아이디
서버: Oracle server IP


Step 6: Start your application and enjoy.

TOAD or SQL*PLUS를 사용한다.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/16 11:57 2007/06/16 11:57
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2473

차를 마셔요, 우리

차를 마셔요, 우리

오래오래 참고
기다리는 법을 배우고 싶거든
차를 마셔요, 우리
뜻대로만 되지 않는 세상일들
혼자서 만들어 내는 쓸쓸함
남이 만들어 준 근심과 상처들을
단숨에 잊을 순 없어도
노여움을 품지 않을 수 있는
용기를 배우며 함께 차를 마셔요.


- 이해인의《다른 옷은 입을 수가 없네》에 실린
시 <차를 마셔요, 우리> 중에서 -


* 마음의 여유가 사라져가는 요즈음입니다.
기쁨도, 슬픔도, 자신이 만들어 내는 것이라는 생각이 듭니다.
다른 사람이 무심코 던진 말들이나 행동들로 말미암아
가슴 아플 때 마음을 열고 얘기 나눌 벗이 있다면
세상은 두렵지 않을 것 같네요.
차 한 잔 나누며...여유를 가져보고 싶네요.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/16 10:42 2007/06/16 10:42
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2472


블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2007/06   »
          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
Statistics Graph

Site Stats

Total hits:
180084
Today:
230
Yesterday:
243