1

The next code works well under Firefox, but IE 9 gives udnefiend as result:

var url = "http://www.w3schools.com/xml/note.xml";

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange = function(event){ processRequest(event,xmlhttp); };
xmlhttp.send();

function processRequest(event,xmlhttp) {
    if(xmlhttp.readyState != 4) return;
    if(xmlhttp.status != 200) return;
    var responseXML = xmlhttp.responseXML;
    alert(responseXML.getElementsByTagName("note")[0].getElementsByTagName("to")[0].textContent);
}

How can I get the textContent of an XML element in IE9?

1
  • i think it's just text or textValue, but i am not that sure
    – philipp
    Jan 16, 2013 at 12:37

1 Answer 1

0

To access the value of any node from an XML DOM object, use the property

dom_node.nodeValue;

textContent is not a W3C standard recommendation. Request you to use the standard properties which are cross-browser compatible.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.