XML --> ASP tutorial?

Discussion in 'ASP General' started by Travis Pupkin, Feb 4, 2005.

  1. Hi,

    I'd like to take the contents of an XML file and bring the data into an
    ASP document as an array. Sounds pretty simple (and even though I
    primarily use ASP, I was able to figure out PHP's SimpleXML in about 10
    minutes to do something similar).

    Anyway, I'm having a terrible time finding an online resource to walk me
    through it.

    I know I can connect the XML file and retrieve the data in a fairly
    static manner using Microsoft.XMLDOM, but what I'd like to learn is how
    to cycle through all of the child nodes and populate an array in one
    swoop, but I can't find the proper syntax for it.

    Most of the online XML resources seem to focus on .NET or other non-
    Classic ASP systems.

    Thanks.
     
    Travis Pupkin, Feb 4, 2005
    #1
    1. Advertising

  2. Travis Pupkin wrote:
    > Hi,
    >
    > I'd like to take the contents of an XML file and bring the data into
    > an ASP document as an array. Sounds pretty simple (and even though I
    > primarily use ASP, I was able to figure out PHP's SimpleXML in about
    > 10 minutes to do something similar).
    >
    > Anyway, I'm having a terrible time finding an online resource to walk
    > me through it.
    >
    > I know I can connect the XML file and retrieve the data in a fairly
    > static manner using Microsoft.XMLDOM, but what I'd like to learn is
    > how to cycle through all of the child nodes and populate an array in
    > one swoop, but I can't find the proper syntax for it.
    >
    > Most of the online XML resources seem to focus on .NET or other non-
    > Classic ASP systems.
    >
    > Thanks.


    The XMLDOM reference can be found here:
    http://msdn.microsoft.com/library/en-us/xmlsdk/html/xmmscXML.asp
    You basically want to concentrate on the DOM reference.


    For a quick example:

    <%
    dim xmldoc, ar(1), oNode, i
    set xmldoc=createobject("msxml2.DOMDocument")
    xmldoc.loadxml "<root><node>data1</node><node>" & _
    "data2</node></root>"
    i=0
    for each oNode in xmldoc.documentelement.childnodes
    ar(i) = oNode.text
    next
    %>

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Feb 4, 2005
    #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. Rensjuh
    Replies:
    7
    Views:
    1,039
    Mabden
    Sep 2, 2004
  2. W. Watson
    Replies:
    13
    Views:
    1,117
    W. Watson
    Sep 20, 2007
  3. Linuxmank
    Replies:
    36
    Views:
    1,544
    Linuxmank
    Aug 8, 2009
  4. Guennadi V. Vanine
    Replies:
    0
    Views:
    237
    Guennadi V. Vanine
    Aug 21, 2003
  5. Erik Wasser
    Replies:
    5
    Views:
    515
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page