Regarding error in loading the xml in jsp page

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 like this



function get_method()

{



createXMLHttpReq();

var url = “/treestructure/tree.do?method=getTreeData”;

req.open(“GET”,url,true);

req.onreadystatechange = load_districts;

req.send(null);



} // end of get_districts()



function load_districts()

{



if(req.readyState == 4)

{



if(req.status == 200)

{

alert(‘this is get_district function()’);

//var xmlDoc = req.responseXML;

tree2=new dhtmlXTreeObject(“treeboxbox_tree2”,“100%”,“100%”,0);

            tree2.setImagePath(“./codebase/imgs/csh_bluebooks/”);

            tree2.enableCheckBoxes(1);

            tree2.enableThreeStateCheckboxes(true);

            tree2.loadXML(req.responseXML);

            //tree2.setXMLAutoLoading(req.responseXML);

                        

}// end of if(xmlRequest.status==200)



} // end of if(xmlRequest.readyState==4)



} // end of load_districts()

    

The file is like this





<?xml version='1.0' encoding='iso-8859-1'?>



        

        

    







pls help me out.



Advance Thanx

You are need not load XML through custom code, the component already has all necessary to load data correctly, it can be done as

tree2.loadXML( “/treestructure/tree.do?method=getTreeData”);

In common case, the same error occurs when incoming XML stream contains some syntax errors.
dhtmlx.com/docs/products/dhtmlxG … rt_comprob