<%   
    Dim xmlPars
    Dim root
    Dim list
    Dim title
    Dim date2
    Dim url
    DIM i, subject, regdate

    Set xmlPars = Server.CreateObject("MicroSoft.XMLDOM")

    xmlPars.AppendChild(xmlPars.createProcessingInstruction("xml", "version=""1.0"" encoding=""UTF-8"""))
   
    Set root = xmlPars.CreateElement("scp")

    xmlPars.AppendChild(root)

    '### 각 노드에 값을 지정한다 ###
    For i = 0 To 3
        subject = "test"
        regdate = "2009-04-01"

        Set list = xmlPars.CreateElement("list")

        root.AppendChild(list)

        Set title = xmlPars.CreateElement("title")
        Set date2 = xmlPars.CreateElement("date")
        Set url = xmlPars.CreateElement("url")

        list.AppendChild(title)
        list.AppendChild(date2)
        list.AppendChild(url)

        list.childNodes(0).text =  subject
        list.childNodes(1).text =  regdate
        list.childNodes(2).text = "http://naver.com"
    Next
    Response.Write xmlPars.xml
%>

<결과 화면>
  <?xml version="1.0" ?>
- <scp>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
  </scp>

반응형

+ Recent posts