Help with XML + ASP

S

scottc

I'm painfully new to XML, so please bare with me. I'm trying to create
an xml document that contains multiple layers. For example,

<root>
<level1>
<name></name>
<id></id>
<primary>
<name></name>
<id></id>
</primary>
</level1>
</root>


Initially, I tried to create the xml document and load it, but it
doesn't work. This seems like it would be easier than trying to create
the xml document in code.

I'm creating my xml object in the global.asa file as follows:

<object runat="server" scope="session" id="XMLObject"
progid="Microsoft.XMLDOM"></object>

This works and allows me to create the xml document within the code.
But, if I try to load the xml document into this object it fails:

xmlobject.load("mydoc.xml")

I have the mydoc.xml document in the same location as the asp file that
I'm running (i.e. wwwroot).

I'm pretty lost and any suggestion would be greatly appreciated.

Thanks,

Scott.........
 
M

Martin Honnen

scottc wrote:

Initially, I tried to create the xml document and load it, but it
doesn't work. This seems like it would be easier than trying to create
the xml document in code.

I'm creating my xml object in the global.asa file as follows:

<object runat="server" scope="session" id="XMLObject"
progid="Microsoft.XMLDOM"></object>

I don't think Microsoft.XMLDOM is suitable as a Session object. I think
you will get more experience in an ASP and/or XML group on the Microsoft
news server news.microsoft.com than in comp.text.xml.
This works and allows me to create the xml document within the code.
But, if I try to load the xml document into this object it fails:

xmlobject.load("mydoc.xml")

What exactly happens, what error messages do you get when you say it fails?
The load method has a return value, the xmlobject has a parseError
property, have you checked them for details?
 
A

Andy Dingley

I'm pretty lost and any suggestion would be greatly appreciated.

MSXML ships with a good help file - take a read. There's a useful
reference to all the DOM properties and methods, and there's also a
few simple bits of example code.

Server.MapPath() is useful too.

I wouldn't begin by creating a DOM in global.asa either. Create your
DOM on the page, as simple inline JScript code. Then (and only if you
need to) there are some techniques you might use for caching this
between pages.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top