Cato,
Right! I tested it out. You can even declare the "root" as a node - as long
as you only have one. But I suppose there are other attributes that may differ
between root and node.
Thanks so much for your thoughtful reply.
Thank you,
Dave
Cato Paus <[EMAIL PROTECTED]> wrote:
Hi Dave.
you have to open the xml whit a root tag, the xml parser think it is
more than one root here because you dident create the root, you went
straight to the nodes, then each node becomes a root ;)
<mx:XML>
<root>
your nodes here.
</root>
</mx:XML>
here is a working sample for you.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Panel height="100%" title="My Links" fontSize="18">
<mx:Tree x="76" y="102" width="343" showRoot="false" id="treLinks"
labelField="@label" fontSize="10">
<mx:dataProvider>
<mx:XML>
<root label="My Url's" id="00000">
<node label="Folder1">
<node label="Leaf1" nodeURL="http://www.qa.com"/>
</node>
<node label="Folder2">
<node label="Leaf2"
nodeURL="http://www.yahoo.com" />
</node>
</root>
</mx:XML>
</mx:dataProvider>
</mx:Tree>
</mx:Panel>
</mx:Application>
one tip don't use the name root. use insted myRoot or something,
I have runned into som bugs when using root.
Cato Paus
--- In [email protected], Dave <[EMAIL PROTECTED]> wrote:
>
> Newbie question here.
> Got the error: Only one root tag is allowed.
>
> The error appears on the <mx:XML> line. Is an XML tree in
dataProvider not allowed?
> Thanks anyone.
> Dave
>
>
> The application is:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
> <mx:Panel height="100%" title="My Links" fontSize="18">
> <mx:Tree x="76" y="102" width="343" id="treLinks" fontSize="10">
> <mx:dataProvider>
> <mx:XML>
> <node label="Folder1">
> <node label="Leaf1" nodeURL="http://www.qa.com"/>
> </node>
> <node label="Folder2">
> <node label="Leaf2"
nodeURL="http://www.yahoo.com" />
> </node>
> </mx:XML>
> </mx:dataProvider>
> </mx:Tree>
> </mx:Panel>
> </mx:Application>
>