Firefox1.5: DOMParser.parseFromString() returns "[Document] null"

S

sfeher

Hi All,

The following code returns a valid xmlDoc (since I can evaluate and
selectNodes) but its value is "xmlDoc=[Document] null" ?! Or at least
this is what the FireBug shows and (xmlDoc===null) is true.

var parser = new DOMParser();
var xmlDoc = parser.parseFromString( responseText, "text/xml");
// at this point: xmlDoc=[Document] null

I'm a bit lost on what this actually means..

Any ideas?

Regards,
Sebastian
 
M

Martin Honnen

var parser = new DOMParser();
var xmlDoc = parser.parseFromString( responseText, "text/xml");
// at this point: xmlDoc=[Document] null

It might be that the output your tool shows you is first the name of the
variable, then its toString() result (which is [Document] so you have a
DOM Document there), then perhaps its nodeValue (which is null by
definition for document nodes).
But I am guessing, ask in a FireBug forum, I don't think that
alert(xmlDoc === null) will show true so that null must have some other
cause.
 
S

sfeher

Martin said:
var parser = new DOMParser();
var xmlDoc = parser.parseFromString( responseText, "text/xml");
// at this point: xmlDoc=[Document] null

It might be that the output your tool shows you is first the name of the
variable, then its toString() result (which is [Document] so you have a
DOM Document there), then perhaps its nodeValue (which is null by
definition for document nodes).
But I am guessing, ask in a FireBug forum, I don't think that
alert(xmlDoc === null) will show true so that null must have some other
cause.

Thanks Martin,

That was indeed the case.

Regards,
Sebastian
 
S

sfeher

Martin said:
var parser = new DOMParser();
var xmlDoc = parser.parseFromString( responseText, "text/xml");
// at this point: xmlDoc=[Document] null

It might be that the output your tool shows you is first the name of the
variable, then its toString() result (which is [Document] so you have a
DOM Document there), then perhaps its nodeValue (which is null by
definition for document nodes).
But I am guessing, ask in a FireBug forum, I don't think that
alert(xmlDoc === null) will show true so that null must have some other
cause.

Thanks Martin,

That was indeed the case.

Regards,
Sebastian
 

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,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top