How to generate dynamic XML from aspx page

Discussion in 'ASP .Net' started by =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?=, Aug 24, 2004.

  1. Dear Friends,
    I was using the below code in ASP to dynamically generate XML from a SQL Query
    Does anyone knows how can I migrate this code to VB and ASPX?

    Regards
    Robson Machado

    Response.ContentType = "text/xml"
    Response.Write "<?xml version='1.0' ?>"
    dim RS, CN
    set CN = server.CreateObject("adodb.connection")
    set RS = server.CreateObject("adodb.recordset")
    CN.ConnectionString = strConnect
    CN.Open
    RS.Open SQLStmt,cn
    Response.Write "<ROOT>"
    Response.Write RS2XML(RS,"RESULT")
    Response.Write "</ROOT>"
    CN.close
    set rs = nothing
    set cn = nothing
    function RS2XML(rs, ChildNode)
    dim Field
    if rs is nothing then exit function
    ChildNode = ucase(ChildNode)
    if rs.eof then
    RS2XML = ""
    exit function
    end if
    do until rs.eof
    if ChildNode <> "" then RS2XML = RS2XML & "<" & ChildNode & ">"
    for each field in rs.fields
    RS2XML = RS2XML & " <" & ucase(field.name) & ">" &
    server.HTMLEncode(NotNull(field.value)) & "</" & ucase(field.name) & ">"

    next
    if ChildNode <> "" then RS2XML = RS2XML & "</" & ChildNode & ">"
    rs.movenext
    loop
    end function
    Function NotNull(vOrig)
    If(IsNull(vOrig)) then
    NotNull = ""
    else
    NotNull = vOrig
    end if
    End Function
     
    =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?=, Aug 24, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?=

    Lucas Tam Guest

    "=?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?="
    <> wrote in news:FCE37981-
    :

    > Does anyone knows how can I migrate this code to VB and ASPX?


    Look at System.XML.

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Aug 24, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,001
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  2. Marco Antonio Montalvo Durán
    Replies:
    2
    Views:
    4,158
    Matt Morris
    Jan 23, 2004
  3. Chris Thunell
    Replies:
    3
    Views:
    3,434
    Edward
    Jul 21, 2004
  4. John M
    Replies:
    1
    Views:
    1,213
    Kumar Reddi
    May 29, 2005
  5. Matt
    Replies:
    3
    Views:
    347
    Bob Barrows [MVP]
    Apr 23, 2004
Loading...

Share This Page