▣ ASP에서 XML파일 읽기
ASP에서 XML파일의 정보를 읽어오는 소스예제입니다.
Ex)
Dim bcdcd_, name_, content_, imgname_
Function designmenu(sort)
Dim oDOM, url, Nodes, SubNodes, de_length
Dim i
url = "juuun.asp"
Set oDOM = Server.CreateObject("Microsoft.XMLDOM")
with oDOM
.async = False
.setProperty "ServerHTTPRequest", True
.Load(url)
end with
de_length = CInt(oDOM.getElementsByTagName(sort).length)
ReDim bcdcd_(de_length), name_(de_length), content_(de_length), imgname_(de_length)
if oDOM.Load(url) Then
Set Nodes = oDOM.getElementsByTagName(sort)
i = 0
For each SubNodes in Nodes
bcdcd_(i) = SubNodes.getElementsByTagName("bcdcd")(0).Text
name_(i) = SubNodes.getElementsByTagName("name")(0).Text
content_(i) = SubNodes.getElementsByTagName("content")(0).Text
imgname_(i) = SubNodes.getElementsByTagName("imgname")(0).Text
i = i+1
Next
End If
Set Nodes = Nothing
Set oDOM = Nothing
End Function
-------------------------------------------------------------------------------------------------------
url = "juuun.asp" 대략소스
response.write "<?xml version=""1.0"" encoding=""euc-kr"" ?>" & Chr(13) & Chr(10)
response.write "<designers>" & Chr(13) & Chr(10)
If IsArray(aryTmpDesign_D90) Then
For i=0 To UBound(aryTmpDesign_D90, 2)
'브랜드코드;브랜드명;디자이너명
response.write "<masstige>" & Chr(13) & Chr(10)
response.write "<bcdcd>"& cutstring___(aryTmpDesign_D90(0,i),0) &"</bcdcd>" & Chr(13) & Chr(10)
response.write "<bcdnm><![CDATA["& cutstring___(aryTmpDesign_D90(0,i),1) &"]]></bcdnm>" & Chr(13) & Chr(10)
response.write "<name><![CDATA["& cutstring___(aryTmpDesign_D90(0,i),2) &"]]></name>" & Chr(13) & Chr(10)
response.write "<content><![CDATA["&aryTmpDesign_D90(1,i)&"]]></content>" & Chr(13) & Chr(10)
response.write "<imgname><![CDATA["&aryTmpDesign_D90(2,i)&"]]></imgname>" & Chr(13) & Chr(10)
response.write "</masstige>"
Next
End If
response.write "</designers>"
'Language > ASP' 카테고리의 다른 글
recordset 객체 (0) | 2012.04.24 |
---|---|
ASP로 간단한 게임 만들기 (같은그림찾기) (0) | 2012.04.24 |
에러처리 On Error Resume Next 와 On Error Goto 레이블명 (0) | 2012.04.24 |
ASP XRS사용 (0) | 2012.04.24 |
Include 와 Server.Execute 의 차이점 (0) | 2012.04.24 |