Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Systec on Jun 13, 2007 09:03
open dhtmlx forum
Incorrect XML

Hi

I've adapted your sample JSP example with a servlet but keep getting the infamous 'Incorrect XML' error message.

My servlet code is simple and as follows:

        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><clients><client><name>hello</name><title>mr</title><dob>01 Jan 1970</dob></client></clients>";
        response.setContentType("text/xml");
        response.setHeader("Cache-Control", "no-cache");
        response.getWriter().write(xml);

My index.html page is very similar to the one in the example and is as follows:

        function doOnLoad(){
            mygrid = new dhtmlXGridObject('gridbox');
            mygrid.setHeader("First Name, Title, Date of Birth");
            mygrid.setColTypes("ed,ed,ed");
            mygrid.setInitWidths("150,50,100")
            mygrid.setColAlign("left,left,left")
            mygrid.setColumnColor("#f7f6f0,#ffffff,#f7f6f0")
            mygrid.loadXML(loadDataURL);           
            mygrid.init()           
        }

From my FireFox 2.0.0.4 debugger i can see the XML returned and it looks ok. Details are as follows:

Response Headers
Date    Wed, 13 Jun 2007 06:55:58 GMT
Server    Oracle Containers for J2EE
Content-Length    131
Connection    Keep-Alive
Keep-Alive    timeout=15, max=100
Content-Type    text/xml; charset=ISO-8859-1
Cache-Control    no-cache

<?xml version="1.0" encoding="UTF-8"?><clients><client><name>hello world</name><title>mr</title><dob>01 Jan
 1970</dob></client></clients>

If i send a request to the same URL from the same html page using a native XMLHttpRequest object i get back a valid XML response. Any ideas?

Thanks in advance.
Answer posted on Jun 13, 2007 11:07
Basically grid uses the same XMLHttpRequest object, so if it work for normal object it will work for grid as well.
In your case problem caused by XML text itself - grid expects to find standard "//rows/row/cell" structure but instead of it it got "//clients/client/_some_"
While in theory it possible to adapt grid to different XML schema, without code modification grid will work only with standard XML tag names
Answer posted by Inga (Support) on Dec 01, 2014 22:40

I hope this information will be enough for you. But you also can have a look at dhtml datagrid and php ajax tree menu.