Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   XML --> ASP tutorial? (http://www.velocityreviews.com/forums/t797841-xml-asp-tutorial.html)

Travis Pupkin 02-04-2005 12:30 AM

XML --> ASP tutorial?
 
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.

Bob Barrows [MVP] 02-04-2005 01:25 AM

Re: XML --> ASP tutorial?
 
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...l/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"




All times are GMT. The time now is 08:45 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.