Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mike H on Feb 06, 2009 12:46
open dhtmlx forum
Loader structure different in IE?

I have an application that works fine in Netscape 7.x, but does NOT work in IE 7.

The problem seems to be the loader object that is returned from the dhtmlxAjax.postSync() call.

In netscape, the loader.xmlDoc.responseXML behaves as i expect. I can pass it to grid.parse(), works fine. In IE, i get the error "Incorrect XML" if i try to pass loader.xmlDoc.responseXML to grid.parse(). However, if i pass just the loader object itself, it works in IE.

But even worse is when I try to navigate the XML myself to populate form elements. No matter what part of the structure I use, my parsing routine (which works fine in Netscape) breaks in IE. This is my code:

function updateNamedElements(xmlObj, formName){
var root = xmlObj.getElementsByTagName('elements')[0];
var items = root.getElementsByTagName('element');
for (var i = 0 ; i < items.length ; i++) {
var item = items[i];
// now we have the item object, time to get the contents
// get the name of the item
var name = item.getAttribute('id');
// get the value
var value = item.firstChild.nodeValue.replace(/^\s+|\s+$/g, '');
var element= document.forms[formName].elements[name];
if (element != null){
if (element.type == 'text' || element.type == 'hidden') element.value= value;
if (element.type == 'select-one') {
for (j = 0; j < element.length; j++) {
if (element.options[j].value == value){
element.selectedIndex = j;
break;
}
}
}
}
}
}
Answer posted by Alex (dhtmlx) on Feb 09, 2009 09:41

Please, check that encoding of the xml is utf-8.

We have tested the following approach - it works correctly in all browsers:

...

dhtmlxAjax.get(grid_xml,outputResponse);
function outputResponse(loader){

grid.parse(loader.xmlDoc.responseXML);
}