Error type: LoadXML Description: Incorrect XML

I know that this is a common problem, But I can’t seem to get past it. I am evaluating many of the components here, and I get this error whenever I try and load any XML file from the examples. Datagrid, grid, tree…

I am calling them just as shown in the examples …

mygrid = new dhtmlXGridObject(Div2); mygrid.setImagePath("/imgs/"); mygrid.setHeader("Column A, Column B"); mygrid.setInitWidths("100,250"); mygrid.setColAlign("right,left"); mygrid.setColTypes("ro,ed"); mygrid.setColSorting("int,str"); mygrid.enableMultiselect(true); mygrid.init(); mygrid.setSkin("dhx_skyblue"); mygrid.loadXML("grid.xml");

I have moved the grid.xml file to different directories, thinking that the system can’t find the file. I am using firefox. I think the system can’t find the file. I believe that the same error would also be generated if the file was not found. How can I track this problem down? The Gantt chart example works … but I am not loading any data from a file. In the above example the column headers do print before I get the error. I like your components a lot. I hope I can get this resolved.

these are the libs I am loading

RegisterScript( 'Scripts/dhtmlxcommon.js', 'js', InstanceName ); RegisterScript( 'Scripts/dhtmlxgantt.js', 'js', InstanceName ); RegisterScript( 'Scripts/dhtmlxgrid.js', 'js', InstanceName ); RegisterScript( 'Scripts/dhtmlxgridcell.js', 'js', InstanceName );

Thank in advance.
Rich

I got got working. I wrote my own server side file reader. I read the file and send back the file as a string, then call the parse function to load the string into the control. For what I need the controls to do, I had to write a file reader anyway. All is good. :slight_smile:

Spoke to soon. The tree control will not load the XML string. Now I get a data structure error. XML refers to non existing parent. My xml string is fine. What can cause this problem?

BTW… your grid control gave me errors too when loading XML string with the
loadXMLString() function. It was not until I used the Parse() function on the grid did my string work. Whats up !!? Should not be so hard to evaluate your controls. A simple forum search shows that these ‘Data’ problems are not new, and an as of yet, not a ‘clear’ answer of what can cause these errors within the different controls. Any insight on the tree control?

Going deeper … actually the xml file was not fine. I used the example file that came with the downloads … ‘tree_b.xml’. Apparently there is an “&” sign in two of the entries within the file. After changing “&” to "and’ the file loaded. Now the problem is how to import files with the “&” sign in them. I changed the header to encoding=“UTF-8”? , and set the tree to tree.setEscapingMode(“utf8”), but it still chokes when loading the file. Here is the error report…

The next error ocured :<br> <strong>DataStructure [XML refers to not existing parent]</strong> in <strong>none</strong> at line <strong>none</strong>

 Tree 0
parentObject=[object HTMLDivElement]
_itim_dg=true
dlmtr=,
dropLower=false
xmlstate=1
mytype=tree
smcheck=true
width=100%
height=100%
rootId=0
childCalc=null
def_img_x=18px
def_img_y=18px
def_line_img_x=18px
def_line_img_y=18px
_dragged=
_selected=
style_pointer=pointer
_aimgs=true
htmlcA= [
htmlcB=]
lWin=[object Window]
cMenu=0
mlitems=0
iconURL=
dadmode=0
slowParse=false
autoScroll=true
hfMode=0
nodeCut=
XMLsource=0
XMLloadingWarning=0
_idpull=[object Object]
_pullSize=1
treeLinesOn=true
tscheck=true
timgen=true
dpcpy=false
_ld_id=null
_oie_onXLE=
imPath=
checkArray=iconUncheckAll.gif,iconCheckAll.gif,iconCheckGray.gif,iconUncheckDis.gif,iconCheckDis.gif,iconCheckDis.gif
radioArray=radio_off.gif,radio_on.gif,radio_on.gif,radio_off.gif,radio_on.gif,radio_on.gif
lineArray=line2.gif,line3.gif,line4.gif,blank.gif,blank.gif,line1.gif
minusArray=minus2.gif,minus3.gif,minus4.gif,minus.gif,minus5.gif
plusArray=plus2.gif,plus3.gif,plus4.gif,plus.gif,plus5.gif
imageArray=leaf.gif,folderOpen.gif,folderClosed.gif
cutImg=0,0,0
cutImage=but_cut.gif
dragger=[object Object]
htmlNode=[object Object]
allTree=[object HTMLDivElement]
XMLLoader=[object Object]
utfesc=utf8
checkBoxOff=true
cBROf=false
dADTempOff=true
dragAndDropOff=true
skipLock=true
parsingOn=null
parsedArray=
setCheckList=
nodeAskingCall=
_p=[object Object]
---------------------
<parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml">XML Parsing Error: not well-formed
Location: http://127.0.0.1:9119/
Line Number 4, Column 28:<sourcetext>		&lt;item text="Mystery !!! &amp; Thrillers" id="mystery" en="1"&gt;
-----------------------------------------^</sourcetext></parsererror>
---------------------
Node: 0 Childs: 0

Thoughts…?

BTW… I am purchasing your controls today. I don’t see any problems that can’t be worked thought. :slight_smile:. Nice job with the library.

Rich

Now I get a data structure error. XML refers to non existing parent. My xml string is fine. What can cause this problem?

Top element of XML contains reference to parent id

- xml will be parsed and new items will be added to parent item with ID 0
by default 0 is ID of virtual root item ( can be changed by using 4th parameter of constructor )

Error in your case means that tree element contains not existing top id value

xml’. Apparently there is an “&” sign in two of the entries within the file.
File contains only escaped sequences : &
If you are loading data from XML string and placing xml code in the html page before loading - it possible that data double processed - first time as part of html code, second time as part of xml - which is causing the issue.

something like next must be safe

//data in textarea will not be processed by html parser <textarea id="data" style="display:none">... place xml data here... </textarea> ... tree.loadXMLString(document.getElementById("data").value)