Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Yuri Mikhel on Jun 02, 2008 23:50
open dhtmlx forum
I am using AJAX framework get and load XML data for the table.

Hi,

Thank you for your quick reply.
I am using AJAX framework get and load XML data for the table.

On the server side I am doing this (Java servlet):

response.setContentType('text/xml;charset=utf-8');
textOut = response.getWriter();
textOut.print(XMLUtil.getDomAsString(xmlDoc));  //xmlDoc here is org.w3c.dom.Document object and XMLUtil.getDomAsString method returns string representation of the document using following code:

import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
import com.sun.org.apache.xml.internal.serialize.OutputFormat;
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;

OutputFormat format = new OutputFormat(xmlDoc);
String stringOut = new StringWriter();
XMLSerializer serial = new XMLSerializer(stringOut, format);
serial.asDOMSerializer();
serial.serialize(xmlDoc.getDocumentElement());
return stringOut.toString();

Then I send it back to client using [new XMLHttpRequest.responseXML] for FF or [new ActiveXObject('Microsoft.XMLHTTP').responseXML] for IE object and process as follows:
function processResponse(xmlDoc, requestObject) {
        if (xmlDoc.documentElement.getElementsByTagName('row').length > 0) {
               grid.parse(xmlDoc);              
        }
        ...
}

That's all. This framework works fine in our application for years for both browsers,
I also can parse it by myself to see that the returned object is valid and correct, but grid's parse method call just hangs... :(

Answer posted by Support on Jun 03, 2008 02:28