Reputation: 620
I have a line that gets the nodeValue of a Node:
parent.getElementsByTagName("Url")[0].nodeValue
that returns nothing:
<br/>
When I do:
parent.getElementsByTagName("Url")[0].toxml()
it returns:
< Url>www.something.com< /Url>
I am not sure what is going on here. Another data point: when I do nodeName instead of nodeValue it returns, as expected, Url.
Any thoughts?
Upvotes: 7
Views: 4809
Reputation: 16625
Try this:
parent.getElementsByTagName('Url')[0].childNodes[0].nodeValue
Upvotes: 7
Reputation: 86652
The DOM Level 2 documentation states that nodeName
for an element node is the tag name, the nodeValue
is always null
and attributes
is a NamedNodeMap
, so this code behaves as expected.
Upvotes: 0