Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Srisudhir on Nov 13, 2008 05:19
open dhtmlx forum
loadXMLString in JSP giving error for dxhtmltree

Hi I have the following XML
<?xml version="1.0" encoding="iso-8859-1"?><tree id="0"><item text='XXCSS_SCDC_OVERRIDE_APPROVER' id='1' im0='tableIcon.gif' im1='tableIcon.gif' im2='tableIcon.gif' ><userdata name='NAME'>XXCSS_SCDC_OVERRIDE_APPROVER</userdata> <userdata name='PARENT'>null</userdata> <userdata name='TYPE'>TABLE</userdata> <userdata name='C3AVL'>null</userdata> <userdata name='PRDAVL'>null</userdata> <userdata name='WRAPPER'>null</userdata> <userdata name='WRAPPERDET'>null</userdata> </item></tree>

When i put this in a xml file and open the tree_design.html (in samples directory) it opens the page properly

But when i put the same html as a jsp page and try to use loadXMLString()
it is igiving Data Structure error, invalid parent

Here is the javascript code i am using

            tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
            tree.setImagePath("./common/");
            tree.enableDragAndDrop(0);
            tree.enableTreeLines(false);
            tree.setImageArrays("plus","","","","plus.gif");
            tree.setImageArrays("minus","","","","minus.gif");
            tree.setStdImages("book.gif","books_open.gif","books_close.gif");
            tree.attachEvent("onClick",onNodeSelect)
            tree.loadXMLString('<c:out value="${tree.xmlContent}"/>');

I put an alert for the tree.xmlContent and it is rendering te proper xml content
Answer posted by Support on Nov 13, 2008 05:52
loadXMLString in IE has limitation - it accepts XML only in UTF encoding, data in non-UTF encoding can be loaded only from remote URL ( this is limitation of browser ) 

Also, in above code snippet you have single quotes in loadXMLString command and the same quotes in xml , it may cause problems if quotes not escaped during output.