Wrong XML

Hi,
I’m using dhtmlxGrid control in my application. I’ve purposefully provided wrong XML in grid.loadXML() api. It is not in standard format as dhtmlxGrid component needed. Still any error is not getting generated. The grid component gets successfully loaded with no columns and rows. Can I make it strict to generate error if proper XML is not provided??

Thanks

Try to use the following approach to catch Load XML error:

function my_error_handler(type, name, data){
}
dhtmlxError.catchError(“LoadXML”,my_error_handler);

I’ve attached error_handler to grid object. I’ll give you an example.

the grid needs xml in following format.

<?xml version="1.0" encoding="iso-8859-1" ?> first column data second column data first column data second column data

But I’m providing it in following format:

Error Title
Error Message

The above XML I’m using to send error xml from server in loadXML() api. But no error is generated by dhtmlxGrid. So how can I avoid it??

sorry I don’t want to avoid it…i want it to generate an exception…

You can use following code to handler such xml:

mygrid.attachEvent("onXLE",function(a,b,c,xml){ if ((xml.documentElement||xml.firstChild).tagName != "rows" ) alert("I'm incorrect"); })

Hi Olga,

I saw this event ( onXLE ) on the documentation, but it is for the professional version, I’m using a GPL version, how could I handle with this?

Error Title Error Message

Thanks and Regards

Leonardo

Next can be used ( it relays on inner properties of grid, so may be broken by future updates )

mygrid.load(url, function(){ var xml = mygrid.xmlLoader.responseXML; if ((xml.documentElement||xml.firstChild).tagName != "rows" ) alert("I'm incorrect"); })