Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading a XML file (using XMLDOM)

Status
Not open for further replies.

Saviour

Programmer
Feb 6, 2001
7
VE
Hi,

I need to load a XML file from URL. I'm using the following instructions:

----------------------------------------------------------
Dim oXMLdoc
Set oXMLdoc=server.createObject("Microsoft.XMLDOM")
oXMLDoc.async = False
oXMLDoc.Load ("c:\test.xml")
Set currNode = oXMLDoc.firstChild
For i = 0 To currNode.childNodes.length - 1
...
...
----------------------------------------------------------
The server send the following message:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required
/Client/Saviour/XMLTree.asp, line 6
----------------------------------------------------------
When I use the method "loadXML" with a string variable, it works.

Thanks for your help.


 
Hi.

Try the following:

Dim oXMLdoc
Set oXMLdoc=server.createObject("Microsoft.XMLDOM")
oXMLDoc.async = False
oXMLDoc.Load ("c:\test.xml")
Set currNode = oXMLDoc.documentElement.firstChild
For i = 0 To currNode.childNodes.length - 1
...


I hope it helps. Kirilla
 
Sorry Kirilla,

Don't works. The error message is the same:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'documentElement'
/Client/Saviour/XMLTree.asp, line 5
 
Hi.

I've tried the following code and it was worked:

<Script Language=&quot;VBScript&quot; Runat=&quot;Server&quot;>

Dim oXMLdoc
Set oXMLdoc=server.createObject(&quot;Microsoft.XMLDOM&quot;)
oXMLDoc.async = False
oXMLDoc.Load (Server.MapPath(&quot;cddata.xml&quot;))
Set currNode = oXMLDoc.documentElement
Response.Write(currNode.childNodes.length)

</Script>


regards, Kirilla
 
Thanks very much Kirilla,

The solution was the method &quot;Server.MapPath&quot;. It's working.

regards, Saviour.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top