How to get text content of xml node in Internet Explorer?
Date: 01/23/06
(Javascript Community) Keywords: html, xml, java, microsoft
node is an element of xml (not xhtml!) document, is a child of response.xml.documentElement (from XmlHttpRequest or Msxml2.XMLHTTP, Microsoft.XMLHTTP).
Code var textContent = node.textContent works fine in Firefox and doesn't worsk in IE. I don't know how to get text contents of a node in IE, because of under it:
1. typeof node.textContent == undefined
2. typeof node.innerText == undefined
3. typeof node.innerHTML == undefined (it is normal, checked just in case)
4. typeof node.nodeValue == null (it's ok)
I use javascript code "inside" html document, declared as
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Do you have any ideas?
update:
texContent = node.firstChild.nodeValue
It's enough in my case. You can [recursively] concatenate nodeValues of all text childs of given element if need.
ps: sorry for my english...
Source: http://community.livejournal.com/javascript/90948.html