일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 외래키
- 뒤로 가기
- quota
- rsync
- xcache
- 중독 게임
- strtotime
- 특정 패키지 업데이트 중지 / 해제
- openfire
- 앞으로 가기
- php-fpm
- simplexml_load_filesimplexml
- 쁘띠프랑스
- ssmtp
- node 이미지 저장
- set foreign_key
- mongodb
- MySQL
- 태권브이
- security.limit_extensions
- 워드프레스한글팩
- 재귀쿼리
- 이미지주소추출
- 날짜계산
- 훼인
- 태권v
- php
- node.js
- no key alg
- 리플리케이션 오류
- Today
- Total
일상 기록 창고
XML 파일 생성 본문
<%
'Dom생성
set objDom =
Server.CreateObject("Msxml2.DOMDocument.4.0")
objDom.preserveWhiteSpace = True
objDom.async = false
' =========================================================
'xml 루트 엘리먼트 생성.
Set xmlDoc =
objDom.CreateElement("root")
SQL = "쿼리문"
Set RX = dbCon.Execute (SQL)
i = 1
j = 1
If Not RX.EOF Then
Do until RX.EOF
'xml루트
엘리먼트의 자식 생성
If RX("sec") = 1
Then
Set xmlNode = objDom.CreateElement("index")
'속성선언.
Set xmlAtr =
objDom.CreateAttribute("code")
xmlAtr.Text =
i
xmlNode.setAttributeNode xmlAtr
Set xmlAtr =
objDom.CreateAttribute("text")
xmlAtr.Text =
RX("cate_name")
xmlNode.setAttributeNode xmlAtr
'title엘리먼트에 Text 삽입.
xmlDoc.appendchild
xmlNode
i = i + 1
j =
1
Else
Set secNode =
objDom.CreateElement("item")
Set secAtr =
objDom.CreateAttribute("code")
secAtr.Text =
j
secNode.setAttributeNode secAtr
Set secAtr =
objDom.CreateAttribute("text")
secAtr.Text =
RX("cate_name")
secNode.setAttributeNode secAtr
xmlNode.appendchild secNode
j = j + 1
End If
RX.MoveNext
Loop
'루트엘리먼트 만드는 문구
objDom.appendchild xmlDoc
'encoding방식 지정.
Set xmlPI =
objDom.createProcessingInstruction("xml","version='1.0'
encoding='euc-kr'")
objDom.insertBefore xmlPI,
objDom.ChildNodes(0)
'xml save지정.
s_path = "파일위치 및 파일
명.xml"
objDom.save(s_path)
End If
%>
멀티 셀렉트의 경우 카테고리에 많이 사용되는데, 보통 디비를 이용해 셀렉트 박스로
뿌려주는 경우가 많다.
멀티 셀렉트 박스의 경우 (특히 카테고리를 표현할 경우), 첫번째 셀렉트 박스를 선택 하면
두번째 셀렉트 박스에 해당 내용이 나오는 방법을 많이 사용한다.
이 경우 문제는 페이지가 리로드 되는 현상이다. 이 방법은 요즘에 들어 화면이 깜박이는 것
때문에 꺼리는 추세이고, 이런 한 것들을 방지하기 위해 모든 내용을 div를 이용해 다 뿌려주고
숨긴 후에 선택시 나타나는 태그를 이용하거나 xml을 이용한 방법이 있다.
저 소스의 경우 디비를 통해서 insert or update 마다 실행시켜 xml을 업데이트 시키게 하였다.
<?xml version="1.0"
encoding="euc-kr"?>
<root>
<index code="1"
text="서울">
<item code="1"
text="신촌/이대/홍대"/>
<item code="2"
text="대학로/종로"/>
<item code="3"
text="압구정/로데오"/>
<item code="4"
text="강남역/논현"/>
</index>
</root>
생성된 xml 소스
ajax 를 이용한 셀렉트 방법은 다음 기회에..