ASP XML 조회 함수

우대희·2020년 5월 26일
0

ASP

목록 보기
1/5
Set m_DOM=Server.CreateObject("Microsoft.XMLDOM")
m_DOM.async=False

m_DOM.loadXML(sXML) //sXML 은 XML문서

'Set list_var=m_DOM.selectNodes("/rss/channel/item")		
'item_no=getItemVar(list_var(0), "no") '상품번호

Function getItemVar(tmpvar, tmpnode)
	If Not tmpvar.selectSingleNode(tmpnode) Is Nothing Then
		tmp_value=tmpvar.selectSingleNode(tmpnode).Text
	Else
		tmp_value=""
	End if			
	getItemVar=tmp_value
End Function

'item_no=getItemVar2(list_var(0), "no", "no2") '상품번호2
Function getItemVar2(tmpvar, tmpnode, tmpnode2)
	If Not tmpvar.selectSingleNode(tmpnode) Is Nothing Then
		If Not tmpvar.selectSingleNode(tmpnode).selectSingleNode(tmpnode2) Is Nothing Then
			tmp_value=tmpvar.selectSingleNode(tmpnode).selectSingleNode(tmpnode2).Text
		Else
			tmp_value=""
		End if			
	End if
	getItemVar2=tmp_value
End Function

'item_no=getItemVar3(list_var(0), "no", "no2", "no3") '상품번호3
Function getItemVar3(tmpvar, tmpnode, tmpnode2, tmpnode3)
	If Not tmpvar.selectSingleNode(tmpnode) Is Nothing Then
		If Not tmpvar.selectSingleNode(tmpnode).selectSingleNode(tmpnode2) Is Nothing Then
			If Not tmpvar.selectSingleNode(tmpnode).selectSingleNode(tmpnode2).selectSingleNode(tmpnode3) Is Nothing Then
				tmp_value=tmpvar.selectSingleNode(tmpnode).selectSingleNode(tmpnode2).selectSingleNode(tmpnode3).Text
			Else
				tmp_value=""
			End if
		Else
			tmp_value=""
		End if			
	End if
	getItemVar3=tmp_value
End Function
profile
ToTb 웹컨설턴트

0개의 댓글