[Javascript] Parse XML: What to do with with empty nodes

Alan Gardner gardner.alan at gmail.com
Fri Feb 25 14:25:48 CST 2005


How do I check to see if a XML node has a value or not?

I'm using xmlhttp to return an xml document from which I pull data to
display to the user. Occasionally, it returns a node with no value
<project-id/> and my script throws a
"c.getElementsByTagName('project-id')[0].firstChild.data" has no
properties error.  I've tried checking for empty string, null and even
for a boolean value without success.  Suggestions?

Thanks,
Alan



More information about the Javascript mailing list