Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't access XML nodes from ASP!
Message
From
07/06/2001 21:20:03
 
 
To
04/06/2001 16:24:59
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00514817
Message ID:
00516722
Views:
9
>Hi all,
>
>I'm having trouble getting the most simple example to work in traversing the XML DOM tree in ASP.
>
>I have an extremely simple XML file called note which I can't list here because it won't allow the tags but it is a very simple and valid document.
>
>And the example code in ASP:
>
>Dim xmlDoc, x
>set xmlDoc=CreateObject("Microsoft.XMLDOM")
>xmlDoc.async="false"
>xmlDoc.load("note.xml")
>
>for each x in xmlDoc.documentElement.childNodes
> response.write(x.nodename)
> response.write(": ")
> response.write(x.text)
>next
>
>I'm getting object required error on line 13 - for each x in xmlDoc.documentElement.childNodes etc.
>
>Basically, anything I try that references documentElement gives me this error.
>
>I verified that the XML doc is valid and that it's loading. I'm running Windows 2000 Pro with IIS (local web) and using IE 5.0 for the browser. I've also verified that MSXML.DLL is in my WINNT/System32 directory.
>
>Anyone seen this problem before? I suspect a problem with my version of the MSXML parser because I'm following the example ver batim.
>
>Thanks for your help!
>
>-JT

Actually, I suspect your problem is in the string you are passing as the file name. A little documented fact is that the load method of the XMLDOM looks in the directory where the XML DLL (i.e.: msxml3.dll) is located as the root, if you don't specify otherwise. So your code is actually looking at something like c:\winnt\system32\note.xml.

If you are using ASP, try this:
xmlDoc.load(Server.MapPath("note.xml"))
Or,you could also specify the whole URL or path to the file directly.

This should solve your problem.
Good luck!
Andres M. Chiriboga, MCSE, MCP+I
Previous
Reply
Map
View

Click here to load this message in the networking platform