달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

asp xml 파싱

ASP 2012. 7. 9. 17:02

<%

url = "http://주소"

Set objXmlHttp  = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")

objXmlHttp.open "POST", url , false


objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

objXmlHttp.send  '요청

strResponseText = objXmlHttp.responseText  '응답 텍스트 저장

Set objXmlHttp  = Nothing

'DOM 파서를 이용해 파싱 

Set objMsXmlDom = Server.CreateObject("microsoft.XMLDOM")

objMsXmlDom.async = false

objMsXmlDom.loadXML( strResponseText ) '스트링으로 로드하기 때문에 loadXML 메서드 사용.

'데이터 추출.

count=objMsXmlDom.getElementsByTagName("yArticleId").length - 1

For i=0 To count


yArticleID   = ""& Trim( objMsXmlDom.getElementsByTagName("yArticleId").Item(i).Text )

acUsersId = ""& Trim( objMsXmlDom.getElementsByTagName("acUsersId").Item(i).Text )

yTitle = ""& Trim( objMsXmlDom.getElementsByTagName("yTitle").Item(i).Text ) ' yTitle = 태그 이름

response.write yArticleID&acUsersId&yTitle

next



Set objMsXmlDom = Nothing

%>

'ASP' 카테고리의 다른 글

msxml3.dll 오류 '800c0005'  (0) 2012.07.17
asp 폴더 내 파일 목록 보기  (0) 2012.07.09
asp에서 웹페이지 소스 가져오기, 파싱  (0) 2012.06.29
ASP UTF-8 파일 읽기,쓰기 및 실행 예제  (0) 2012.05.11
ASP 날짜 처리 함수  (0) 2012.05.10
Posted by dewlit
|