Referencing an empty node
Posted: Sat Oct 24, 2009 1:45 pm
How to access?
1. This works: <name>Joe</name>
nameElement[0].firstChild.nodeValue returns "Joe"
2. This does not work: <name></name>
nameElement[0].firstChild.nodeValue creates an error.
I have tried using a boolean operator to evaluate it (if nameElement....), but that does not work, either.
So, how am I to ever figure out I have an empty text tag?
1. This works: <name>Joe</name>
nameElement[0].firstChild.nodeValue returns "Joe"
2. This does not work: <name></name>
nameElement[0].firstChild.nodeValue creates an error.
I have tried using a boolean operator to evaluate it (if nameElement....), but that does not work, either.
So, how am I to ever figure out I have an empty text tag?