ACTIVE SERVER PAGE > Server.CreateObject("Microsoft.XMLDOM") - ¿ÜºÎ xml ºÒ·¯¿À±â ¿¹Á¦
µî·ÏÀÏ : 2017-07-04 16:46
Á¶È¸¼ö : 53,558
Class XMLDOMClass
Private m_DOM ' XMLDOM °´Ã¼
' ---------------------- »ý¼ºÀÚ -----------------------
Private Sub Class_Initialize()
Set m_DOM = Server.CreateObject("Microsoft.XMLDOM")
End Sub
' ---------------------- ¼Ò¸êÀÚ -----------------------
Private Sub Class_Terminate()
Set m_DOM = Nothing
End Sub
' ------------------- Property Get --------------------
Public Property Get TagText(tagName, index)
Dim Nodes
Set Nodes = m_DOM.getElementsByTagName(tagName)
TagText = Nodes(index).Text
Set Nodes = Nothing
End Property
Public Property Get Nodes(tagName)
Set Nodes = m_DOM.getElementsByTagName(tagName)
End Property
' ------------------- ¿ø°Ý XML Àбâ --------------------
Public Function LoadHTTP(url)
with m_DOM
.async = False ' µ¿±â½Ä È£Ãâ
.setProperty "ServerHTTPRequest", True ' HTTP·Î XML µ¥ÀÌÅÍ °¡Á®¿È
LoadHTTP = .Load(url)
end with
End Function
' ------------------- XML ÆÄÀÏ Àбâ --------------------
Public Function Load(file)
with m_DOM
.async = False ' µ¿±â½Ä È£Ãâ
Load = .Load( Server.MapPath(file) )
end with
End Function
End Class
'¼Ò½º ½ÃÀÛ
dim oDOM, url
' XML µ¥ÀÌÅÍ ÁÖ¼Ò
url = "http://jeonjumart.co.kr/test.asp"
Set oDOM = new XMLDOMClass
with oDOM
if .LoadHTTP(url) Then
For i=0 To 1
Response.Write "start:" & .TagText("start",i) & "
"
Response.Write "step:" & .TagText("step", i) & "
"
Next
else
Response.Write "XMLÀ» Àоî¿À´Âµ¥ ½ÇÆÐÇÏ¿´½À´Ï´Ù."
End if
end with
Set oDOM = Nothing
'---------------------------------------------
test.asp ÆÄÀϳ»¿ë
yes
4
4,1,2,3
9
yes
ÇѱÛÅ×½ºÆ®
5,1,2,3
9