View Full Version : XmlTreeLoader and <root> as the root element in xml doc issue

1 Mar 2011, 6:29 AM
Hello all,
I am using the XmlTreeLoader following the example on the website. My xml is similar to the schema of the author example on the website aside from the fact that it has <root> </root> as the root element. Due to this, it will not load the tree properly. If I remove the <root> element, it loads just fine. I can throw a stylesheet at the xml to remove the root element, but I would rather get it working without that. Is there a way to "ignore" this root element?
My xml looks like so:

<group name="groupname1">
<friend name="friendname1"/>
<friend name="friendname2"/>

The js code is very close to the example:

Ext.app.BookLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, {
processAttributes : function(attr){
else if(attr.friendName){ //friend

new Ext.Panel({
title: 'Roster',
renderTo: 'tree',
layout: 'border',
width: 500,
height: 500,
items: [{
xtype: 'treepanel',
id: 'tree-panel',
region: 'center',
margins: '2 2 0 2',
autoScroll: true,
rootVisible: true,
root:new Ext.tree.AsyncTreeNode({text:"Roster"}),

// Our custom TreeLoader:
loader: new Ext.app.BookLoader({

Thanks in advance!