글
ASP에서DOM을 이용한 XML 문서 다루기(1)
언어/XML
2006/03/26 07:43
| ------------ asptest.xml ------------ <?xml version="1.0" encoding="euc-kr"?> <도서> <신청내역> <신청인>홍길동</신청인> <제목>OracleJava</제목> <수량>2</수량> <금액>14,000원</금액> </신청내역> <신청내역> <신청인>이종철</신청인> <제목>XML 5일완성</제목> <수량>3</수량> <금액>19,000원</금액> </신청내역> </도서> ------------ asptest.asp ------------ <%@ language=VBScript %> <html> <meta-equiv="Content-Type" content="text/html; charset=euc-kr" /> <head><title>asptest.asp</title></head> <body> <% dim myDomObj, myRec, myHTML, i 'XML DOM 객체를 생성 set myDomObj = Server.CreateObject("Microsoft.XMLDOM") myDomObj.async=false 'DOM 객체에 asptest.xml 파일을 로딩한다. myDomObj.load Server.MapPath("asptest.xml") //현재노드의 위치를 루트엘리먼트에 위치시킴 set myRec = myDomObj.documentElement for i=0 to myRec.childNodes.Length-1 myHTML = myHTML & myRec.childNodes(i).text & "<hr>" next response.write myHTML set myDomObj=nothing %> </body> </html> |