티스토리 뷰
http://www.w3schools.com/XPath/xpath_syntax.asp
노드들을 하나하나 찾아가는 .item(0)...item(0) 뭐 이런거보다 한방에 찾아가면 편하지 않나.
이 문법을 통해 원하는 노드에 한방에 접근이 가능해진다.
[ASP 에서의 사용 예]
'// xml 화일에 대한 xml dom 객체를 생성시킨다
Set oXML = Server.CreateObject("Microsoft.XMLDOM")
oXML.async=false
oXML.Load Server.MapPath("abc.xml")
// 그룹 노드 Selecting 의 경우
Set theNode = oXML.selectNodes("//container/obj[@id='"& obj_id &"']/item")
For Each oNode In theNode
list("num") = oNode.SelectSingleNode("num").Text
......
Next
// 하나의 노드 Selecting 의 경우
xPath = "//zone[@id='"& zone &"']"
Set theNode = xmlDoc.selectSingleNode(xPath)
If theNode Is Nothing Then
Set xmlDoc = Nothing
append = "0"
End If
노드들을 하나하나 찾아가는 .item(0)...item(0) 뭐 이런거보다 한방에 찾아가면 편하지 않나.
이 문법을 통해 원하는 노드에 한방에 접근이 가능해진다.
[ASP 에서의 사용 예]
'// xml 화일에 대한 xml dom 객체를 생성시킨다
Set oXML = Server.CreateObject("Microsoft.XMLDOM")
oXML.async=false
oXML.Load Server.MapPath("abc.xml")
// 그룹 노드 Selecting 의 경우
Set theNode = oXML.selectNodes("//container/obj[@id='"& obj_id &"']/item")
For Each oNode In theNode
list("num") = oNode.SelectSingleNode("num").Text
......
Next
// 하나의 노드 Selecting 의 경우
xPath = "//zone[@id='"& zone &"']"
Set theNode = xmlDoc.selectSingleNode(xPath)
If theNode Is Nothing Then
Set xmlDoc = Nothing
append = "0"
End If
'웹프로그래밍 > XML' 카테고리의 다른 글
| XPath 의 인덱스 시작 = 0부터 (0) | 2011.09.05 |
|---|---|
| RSS (0) | 2010.07.26 |
| XML DOM 메뉴얼 링크 (0) | 2009.03.25 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- git
- JQuery
- CSS
- javascript
- API
- ASP
- PHP
- nginx
- JSON
- Docker
- mssql
- laravel
- 한글
- classic asp
- Linux
- 안드로이드
- Prototype
- IE
- 워드프레스
- Mac
- Wordpress
- nodejs
- iis
- iphone
- IOS
- macos
- sencha touch
- Android
- centos
- Debug
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함