Internet Explorer (IE) and responseText

Playing a bit on job with xmlhttprequest (more or less on December 2006), I bumped into another IE6 bug (?). I needed to parse an xml stream like the following


yes, with some empty lines before the XML stream. The problems was that empty lines before the xml stream. While Firefox handled them correctly (ignoring), IE6 hanged up silently (as usual) , so no error displayed. Solved in this way

xmlhttp.onreadystatechange = function(){
         result = new ActiveXObject("Microsoft.XMLDOM");
         result = xmlhttp.responseXML;
      cod = result.getElementsByTagName("COD")[0];
         desc = result.getElementsByTagName("DESC")[0];
         alert("Error while... nn" + desc);
         alert("Operation successful");

Ah yes , remember the content-type="text/xml"; charset=...


2 thoughts on “Internet Explorer (IE) and responseText

  1. gregoire says:

    Thank but if i may add a thing,
    the XML nodes of the ajax xml file are in xmlhttp.documentElement
    so the result contain not the same thing on ie and ff/op/saf ; it should be

    doc = new ActiveXObject(“Microsoft.XMLDOM”);
    var result = doc.documentElement

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s