|
-
Oct 19th, 2001, 02:08 PM
#1
Xml Dom
i'm currently learning all about the great wonders of the xml dom... but why the hell won't this code work?!?!
Code:
<%
Set objXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
objXMLDoc.Load("note.xml")
objXMLDoc.async=false
Response.Write objXMLDoc.documentElement.nodeName
For Each objNode in objXMLDoc.documentElement.childNodes
' do whatever
Next
Set objXMLDoc = Nothing
%>
i always get an "object required" error...
thanks in advance!
-
Oct 19th, 2001, 02:22 PM
#2
Black Cat
Shouldn't you set async to false before you load it? Otherwise you could be trying to access its elements before it's fully loaded.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Oct 19th, 2001, 02:29 PM
#3
thanks, josh... unfortunately, that wasn't the problem... i'm still getting the "object required" error... this is driving me nuts at this point... i know it's probably simple to resolve, but those usually present the biggest headaches...
-
Oct 22nd, 2001, 07:19 AM
#4
Black Cat
What line is the error on?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Oct 22nd, 2001, 12:03 PM
#5
well... maybe i've figured out why the root element isn't found... i altered the code to read:
Code:
<%
Set objXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
objXMLDoc.async=false
If objXMLDoc.Load("note.xml") Then
Response.Write "XML Document Loaded."
Else
Response.Write "XML Not Loaded."
End If
Set objRoot = objXMLDoc.documentElement
'strFrom = objRoot.selectSingleNode("from").text
'For Each objNode in objRoot
' do whatever
'Next
Set objXMLDoc = Nothing
%>
this is the source of the file note.xml:
Code:
<?xml version="1.0" ?>
<note>
<to>You</to>
<from>Me</from>
<message>This is a test.</message>
</note>
the result is, of course, 'XML Not Loaded'... what a pain... please help... at this point, i'd rather stab myself in the leg than deal with the xml dom...
-
Oct 23rd, 2001, 06:43 AM
#6
Black Cat
How about if you change this:
Set objXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
to this
Set objXMLDoc = Server.CreateObject("MSXML.DOMDocument")
or this
Set objXMLDoc = Server.CreateObject("MSXML2.DOMDocument")
Will it work any better?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Oct 23rd, 2001, 09:44 AM
#7
thanks again, josh... but it is still returning "XML Not Loaded."... i have no clue at this point... now where is that java book?...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|