XML --> ASP tutorial?

T

Travis Pupkin

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.
 
B

Bob Barrows [MVP]

Travis said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top