Categories | Question details Back To List | ||||||||
FF xml refers to not existing parent error I am getting an "xml refers to not existing parent" error in FF only (works fine in IE). I've looked through the forums and made sure that there is not any whitespace at the beginning of the XML, but cannot find a similar problem. An example of my XML: <tree id="0"><item text="111" id="a" child="1" im0="99.gif" im1="99.gif" im2="99.gif" call="true" select="yes" ><userdata name="type">99</userdata></item> <item text="1A Place" id="5" child="1" im0="99.gif" im1="99.gif" im2="99.gif" call="true" select="yes" ><userdata name="type">99</userdata></item> <item text="1A Project" id="b" child="1" im0="99.gif" im1="99.gif" im2="99.gif" call="true" select="yes" ><userdata name="type">99</userdata></item></tree> The XML code was taken from the page source, but I have trimmed the string that is returned as well. Please help. Answer posted by Stanislav on Dec 07, 2007 15:27 The error mean that after XML loaded the "id" attribute of top tag doesn't reffer to any existing element in tree, and component doesn't know in which place of hierarchy new xml must be added. Default ID of super-root item is 0, so your xml must work. Check the initialization of you tree, the 4th parameter of constructor is rootID value ( if it is not specified - try to specify it ) some = new dhtmlXTreeObject (element,width, height, 0); Answer posted by fcollier on Dec 10, 2007 08:43 Here's my code for initializing the tree: <div id="treeBox" style="width:300px;height:600px;border:solid 2px;"></div><script src="dhtmlxcommon.js"></script> <script src="dhtmlxtree.js"></script> <script> tree=new dhtmlXTreeObject(document.getElementById('treeBox'),'100%','100%',0); tree.setOnClickHandler(redirNode); tree.setXMLAutoLoading("myxml.aspx"); tree.loadXML("myxml.aspx"); </script> As you can see, I have the 0 in there. Is it version dependant maybe? I'm running FF 2.0.0.6 Thank you for your time. Answer posted by Support on Dec 10, 2007 10:07 The code is fully correct , when using your code and XML data with static files all works correctly ( sample attached ) The only reason of problem - your aspx code returns XML in incorrect way. Please be sure that XML from your aspx script outputed with correct content type ( it must be text/xml ) Attachments (1)
Answer posted by fcollier on Dec 11, 2007 14:50 I fixed it. Was sending the xml out with a response.write. I needed to set the response.contenttype to "text/xml". Thank you for your help. |