=====================================================================================
< %@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> '-->자신의 페이지 설정에 맞게
<%
response.charset = "utf-8" '--->자신의 페이지 설정에 맞게
'XML-DOM 프로젝트선언
dim XMLObj
set XMLObj = Server.CreateObject("Microsoft.XMLDOM")
'각 노드와 Attribute 수만큼 변수선언
dim nRoot, nRid, nFst
'<Root>라는 노드 정의
set nRoot = XMLObj.CreateElement("Root")
'<Root>라는 노드를 최상위 노드로 생성
'최상위 노드는 하나만 생성해야 함.
XMLObj.AppendChild(nRoot)
'<Root>라는 노드에 id="horangi" 라는 Attribute를 정의 --><Root id="horangi">.....</Root>
set nRid = XMLObj.createAttribute("id")
nRid.text = "horangi"
'id Attribute를 Root노드에 삽입
nRoot.setAttributeNode nRid
'<first>라는 노드 정의
set nFst = XMLObj.CreateElement("first")
'<first>라는 노드에 내용 정의 --><first>주저리주저리</first>
nFst.text = "주저리주저리"
'<first>노드를 <Root>안에 삽입.
nRoot.AppendChild(nFst)
'본격적으로 위에 정의한 내용을 xml페이지로 작성
response.contentType = "text/xml"
response.write "<?xml version=""1.0"" encoding=""utf-8""?>"
response.write XMLObj.xml
%>
==============================================================================
위처럼 작성하여 xxx.asp로 저장한뒤 서버에 올려놓고 접속을 하면
(예 - http://xxx.com/xxx.asp)
다음과같이 정상적으로 XML페이지로 표기가 된다.
<?xml version="1.0" encoding="utf-8" ?> <first>주저리주저리</first> </Root> |
[출처] [펌]asp로 xml페이지 만들기 |작성자 엄마얘술먹어
'프로그래밍 > ASP' 카테고리의 다른 글
ASP 업/다운로드 용량제한 설정 IIS8 (0) | 2017.11.10 |
---|---|
asp 커리어넷 오픈api 학교주소검색 xml가져오기 (0) | 2017.03.20 |
asp https redirect (0) | 2017.03.15 |
asp 오류페이지 한글깨짐현상 (0) | 2017.02.20 |
asp javascript json array parse 파싱 후 출력하기 (2) | 2016.12.22 |