Parsing prototype AJAX.response XML in IE

Posted by adam on Stack Overflow See other posts from Stack Overflow or by adam
Published on 2009-10-26T17:13:52Z Indexed on 2010/05/28 18:41 UTC
Read the original article Hit count: 344

Filed under:
|
|
|
|

Hi

I have an xml webservice which I'm fetching using PrototypeJS. The xml has the correct content type and is well-formed, and looks like this:

<GetTokenResponse xmlns="http://tempuri.org/">
    <GetTokenResult>F655100D64F098F0AC33AFF414A4A0D5</GetTokenResult>
</GetTokenResponse>

The AJAX request is completing successfully, and I can access the GetTokenResult node in both IE and FF but can only get the text content of the node in FF. My code is below:

node = transport.responseXML.documentElement.getElementsByTagName('GetTokenResult')[0];
rawToken = (document.all) ? node.innerText : node.textContent;

I've tried innerText and innerHTML, as well as children[0] and a few other chance guesses but IE returns 'undefined' when I access rawToken.

Anyone able to lend a hand? Thanks, Adam

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about Xml