Why? Error Type:loadXML ,DataStrcuture

I am new to the dhtmlxtree,i have create a dhtmlxtree(myTree.html),but some problem happened: when i click the “myTree.html”,the tree load successful,but when i put the myTree.jsp(i change the file-postfix “.html” to “.jsp”) in struts 1.2 project, i click the button,it will load a tree in popup window(myTree.jsp will display in a popup window). the web server(Tomcat 6) will popup two alert window say : :question:

window 1 say: Error Type:loadXML Description:Incorrect XML
window 2 say: Error Type:DataStructure Description:XML refers to not existing parent

============================myTree.jsp content==================================
<%@ page contentType=“text/html;charset=UTF-8” pageEncoding=“UTF-8”%>

My Tree <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
var tree=new dhtmlXTreeObject("treeDiv","100%","100%",0); tree.setXMLAutoLoading("basecode/directoryTree/tree.xml"); tree.loadXML("basecode/directoryTree/tree.xml"); tree.enableCheckBoxes(1); tree.setImagePath("basecode/directoryTree/imgs/"); tree.attachEvent("onCheck",function(id,state) { var selectedId=tree.getSelectedItemId(); tree.setCheck(selectedId,state); }); function getNodeData() { var str= tree.getAllChecked(); var nodeIdArray=str.split(","); var nodeTextArray=new Array(); for(var i=0;i<nodeIdArray.length;i++) { nodeTextArray[i]=tree.getItemText(nodeIdArray[i]); }
			var nodeIdString=nodeIdArray.join(",");
			var nodeTextString=nodeTextArray.join(",");
			return true;
<html:form action="/adduserprefer">
			<td><input type="hidden" name="nodeId" id="nodeId"/></td>
			<td><input type="hidden" name="nodetext" id="nodetext"/></td>
			<td><input type="submit"  name="submitData" value="确定" onclick="return getNodeData();" /></td>
			<td><input type="button" name="cancel" value="退出"  onclick="window.close();" /></td>
================================tree.xml content:==================================== <?xml version="1.0" encoding="UTF-8"?>

i have googling rather time to solve the problem,but can not solve it. Somebody help me! i appreciate in advance. thank you!..(i am chinese,english is poor, and i try my best to express my problem clearly,so you can understand it best!)

Liming Xu


make sure that servers-die script generates correct xml stream (content-type should be text/xml). Here are possibly reasons for the “incorrect xml” problem:

docs.dhtmlx.com/doku.php?id=othe … orrect_xml

If you are using php to generate xml content, you have to use the ‘header’ function in top of the code :

header('Content-Type: application/xml');

you may also use the syntax to protect values (or titles?)