Categories | Question details Back To List | ||
tree.loadXml throws error when XML is loaded using jsp Hello, I have two jsps, treeView.jsp calls tree.jsp using the tree.loadXMl(tree.jsp) function as shown below. The inner tree.jsp(also shown below) should load an xml using a stringBuffer. The stringBuffer is passed as a session attribute and it contains the xml contents as shown at the bottom of this message. However I get the following errors: Error Type: LoadXML, Description: Incorrect XML and then Error Type: Data Structure, Description: XML reffers to not existing parent Please let me know what might be wrong with my jsp files shown below. I have also pasted part of the xml which is generated. Thanks. Eric --------------------------------------------------------------------------------- treeview.jsp ----------------------------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Title1</title> </head> <body> <br/> <link rel="STYLESHEET" type="text/css" href="/dhtmlxTree/codebase/dhtmlxtree.css"/> <script src="../../codebase/dhtmlxcommon.js"></script> <script src="../../codebase/dhtmlxtree.js"></script> </div> <div id="treeboxbox_tree" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver;"></div> <script language="javascript"> tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); tree.setImagePath("../../codebase/imgs/csh_yellowbooks/"); tree.loadXML("tree.jsp"); </script> </body> </html> ---------------------------------------------------------------------- tree.jsp -------------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ page contentType="text/xml" %> <%@ taglib uri="/tags/struts-jstl" prefix="c"%> <%@ page import="java.lang.String" %> <%@ page import="java.lang.StringBuffer" %> <html> <head> <title></title> </head> <body> <br/> <div align="center"> <c:out value="${stringBuffer}" escapeXml="true"/> </div> </body> </html> -------------------------------------------------------------------------------- xml printout (when tree.jsp is viewed separately) ------------------------------------------------------------------------------ <div> <?xml version="1.0" encoding="ISO-8859-1"?> <tree id = "0"> <item text="Branch1" id="1"/> <item text="Branch2" id="2"/> <item text="Branch3" id="3"/> <item text="Branch4" id="4"/> </tree> </div> Answer posted by Support on Mar 28, 2008 07:39 Component expects that correct XML will be received from loadXML call, in your case it is a mixed structure . <div> <?xml version="1.0" encoding="ISO-8859-1"?> <tree id = "0"> <item text="Branch1" id="1"/> <item text="Branch2" id="2"/> <item text="Branch3" id="3"/> <item text="Branch4" id="4"/> </tree> </div> The output must not contain marked elements, must be XML tags only |