Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Joby on Apr 09, 2008 02:17
open dhtmlx forum
loadXML not working

When I using loadXML function I got two alert messages

1) Error type:LoadXML
Descriptin :Incorrect XML

2) Error type:DataStructure
Descriptin :XML refers to not existing parent

I have write data to file while calling an ajax function (using java) and then loading this file in a treegrid using "loadXML".

The file is like this

<?xml version='1.0' encoding='UTF-8'?>
<tree id='0'>
    <item text='Types' id='1' open='1' im0='tombs.gif' im1='tombs.gif' im2='iconSafe.gif' call='1' select='1'>
<item text='ABC' id='21' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif' >
            <item text='PQR' id='21~3' im0='book_titel.gif' im1='book.gif' im2='book_titel.gif' >
                <item text='XYZ' id='21~3~10' im0='book_titel.gif' im1='book.gif' im2='book_titel.gif' />
            </item>
        </item>
    </item>
</tree>
Answer posted by Support on Apr 09, 2008 06:09
Please be sure that xml file really exists in moment when loadXML called

If you are loading not from static XML file, please be sure
    - content outputed with text/xml content type
    - there are no unnecessary whitespaces before <?xml tag

You can use debug version of dhtmlxcommon.js to check exact server side response.
    http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=2545&ssr=yes&s=dhtmlxcommon

Answer posted by Josh on May 06, 2008 18:02
Was curious if the original poster figured out the issue. I'm having similar problem as well.
Answer posted by Jaroslav on Aug 28, 2008 19:51
Hello.
I had same problem.
I was using php-generated XML file, probably this one was throwing the error,
later I have added:
header("Content-type: text/xml");
and the problem was solved!

Good luck!
Lovely products out here:)

Answer posted by Support on Aug 29, 2008 01:37
Common problems and their solutions mentioned here - http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Common_Problems_in_Grid.html#grid_art_comprob
( article is grid related, but XML related tips are common for all dhtmlx components )