Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- submit
- utf-8
- ajax
- 무선랜카드
- lsusb
- AC1300
- 크로스 컴파일
- FileSystemObject
- jquery 레이어
- include
- 시놀로지
- 따라다니는 배너
- RTL88x2BU
- readonly
- XMLHTTP
- Getrows
- synology
- replace
- 커널
- form
- ASP
- println
- SQL Injection
- euc-kr
- Injection
- PHP GCM
- DS718+
- jQuery
- javascript
- disabled
Archives
- Today
- Total
아는 것이 좋은 것이다.
[ASP] XML 읽어서 출력 본문
<% Set oDOM = Server.CreateObject("MSXML2.DOMDocument.3.0") with oDOM .async = False ' 동기식 호출 .setProperty "ServerHTTPRequest", True ' HTTP로 XML 데이터 가져옴 .Load(Server.MapPath("/") & "\data.xml") '.save(Server.MapPath("/") & "\test.xml") 'XMLHTTP로 불러온 데이터 저장시 사용 end With Set Nodes = oDOM.selectNodes("//item") ' XML 에서 반복적인 상위키를 기준으로 가져옵니다. Response.write "Nodes=" & Nodes.length & "<BR>" ' item의 개수 For Each NodeSub In Nodes product_name = NodeSub.getElementsByTagName("product_name")(0).Text product_code = NodeSub.getElementsByTagName("product_code")(0).Text product_pirce = NodeSub.getElementsByTagName("product_pirce")(0).Text Response.write "product_name=" & product_name & "<br>" Response.write "product_code=" & product_code & "<br>" Response.write "product_pirce=" & product_pirce & "<br>" Next Response.write "완료!!" %>
XML의 파일을 읽어들여서 갯수와 해당항목을 출력한다.
<?xml version="1.0" encoding="EUC-KR" ?> <data> <items> <item> <product_name>상품1</product_name> <product_code>상품코드1</product_code> <product_pirce>10000</product_pirce> </item> <item> <product_name>상품2</product_name> <product_code>상품코드2</product_code> <product_pirce>20000</product_pirce> </item> <item> <product_name>상품3</product_name> <product_code>상품코드3</product_code> <product_pirce>30000</product_pirce> </item> </items> </data>
테스트용으로 만든 XML(data.xml) 여기의 데이터를 읽어서 뿌려준다.
'ASP' 카테고리의 다른 글
[ASP] 한글, 영문 문자열 자르기 (0) | 2014.07.07 |
---|---|
[ASP] 숫자 앞에 원하는 개수만큼 0 붙이기 (1) | 2014.07.06 |
[ASP] 변수로 인클루드(include) 하기 (0) | 2014.06.23 |
[ASP] XMLHTTP GET으로 파일 읽어오기 (0) | 2014.06.11 |
[ASP] ASP 쌍따옴표 replace (0) | 2014.06.05 |
Comments