How to determine "tree ID" on XML data?

Hi, Im working on a little app that uses dhxLayout and dhxTree, the tree data is loaded via XML, but im having a problem to determine the “tree id” into the XML.

I’ve read the forum and I found that every example is using it (object constructor, with an ID parameter):

tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_bluebooks/");
tree.loadXML("../common/tree_ud.xml");

But, Im using attachTree instead:

      // vars
      var dhxLayout;
      var dhxCellNav;
      var dhxCellDet;
      var dhxTree;
      
      // functions
      function doInit() {
        dhxLayout  = new dhtmlXLayoutObject(document.body,"2U");
        dhxLayout.progressOn();

        dhxCellNav = dhxLayout.cells("a");
        dhxCellDet = dhxLayout.cells("b");
        dhxTree    = dhxCellNav.attachTree();

        dhxTree.setSkin("dhx_skyblue");
        dhxTree.setImagePath("/lib_pta/dhtmlx/dhtmlxTree/codebase/imgs/csh_bluebooks/");
        dhxTree.deleteChildItems(0);
        dhxTree.loadXML("/planteigGes/oPTADDMgr.pPTADataLoadNavigator");

        dhxLayout.progressOff();
      }//fin doInit

So, how do I get rid of the ID for the XML?

<?xml version="1.0" encoding="iso-8859-1"?>
  <tree id="0">
    <item id="1" text="colors">
      <item id="11" text="red" />
      <item id="12" text="yellow" />
    </item>
    <item id="2" text="numbers">
      <item id="21" text="one" />
      <item id="22" text="two" />
    </item>
  </tree>

If I put “0” as ID, I get the following error:
Error type: LoadXML
Description: Incorrect XML

And then this one:
Error type: DataStructure
Description: XML refers to not existing parent

TIP: Im working with IE 7.0

Hi,

attachTree takes rootId as a parameter:

dhxTree   = dhxCellNav.attachTree(0);

However, 0 is default and attachTree() is the same as attachTree(0)

Make sure that /planteigGes/oPTADDMgr.pPTADataLoadNavigator script returns the desired xml:

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

Ok, so I’ve changed this (put the ID on the attachTree -however this thing is not documented-):

dhxTree    = dhxCellNav.attachTree(10);

I’ve checked the XML procedure generator (/planteigGes/oPTADDMgr.pPTADataLoadNavigator) coded in Oracle PL/SQL:

[code]PROCEDURE pPTADataLoadNavigator IS
BEGIN

owa_util.mime_header(‘text/xml’);
htp.print(’<?xml version="1.0" encoding="iso-8859-1"?>’);
htp.print(’’);
htp.print(’ ‘);
htp.print(’ ‘);
htp.print(’ ‘);
htp.print(’ ‘);
htp.print(’ ‘);
htp.print(’’);

END pPTADataLoadNavigator;[/code]

so the output is:

<?xml version="1.0" encoding="iso-8859-1"?> <tree id="10"> <item text="colors" id="idColors"> <item text="red" id="idColorsRed"></item> <item text="yellow" id="idColorsYellow"></item> </item> <item text="simple node" id="idSimpleNode"></item> </tree>

And guess what… it works fine for FireFox, but not for Internet Explorer 7.0, keep getting the same error reported.
The only way to “broke” the thing and get the same error on FF is messing up with HTTP headers.

But dont worry, I have a nasty workaround solution:
* a page just only for the layout.
* a page for the tree object with all the info (elements).
and finally dhxLayout.attachUrl to load / refresh the tree with its info

I was just triying to keep the code clear of this kind of “fixes”.