03-20-2004, 01:08 AM
How would I go about using the DOM to read (and return) the value of an XML tag whose contents are wrapped in a CDATA section?
Currently, I'm pulling the data this way from non-CDATA tags:
03-20-2004, 01:16 AM
Depends on the DOM implementation. Some DOM implementations are bound to have inserted the CDATA section as a TextNode. Some may have the CDATA node there, though. In either case, either the data or the nodeValue property should contain the textual contents of it.
03-20-2004, 01:28 AM
data and nodeValue aren't returning anything (I'm getting blanks). I know that the rest of my code is fine, because I can parse the exact same tag without the CDATA there.
Would something like innerText or whatever work? (I'm dealing exclusively with Gecko 1.4 or newer)
If you're dealing with Gecko exclusively, then you could probably just use a Range:
var r = xmlDoc.createRange();
03-20-2004, 02:06 AM
03-21-2004, 07:40 PM
How would you normalize the content?
03-21-2004, 07:47 PM
03-23-2004, 12:07 AM
Y'know what? It was a whitespace issue. Thanks for pointing me in the right direction guys. :D