I have XML with a value like the following:
<products>
<product id="1" name="All Products">
<code>000</code>
<shortname>ALL</shortname>
<cost>0.0</cost>
<product id="2" name="Product Group A">
<code>001</code>
<shortname>A</shortname>
<cost>0.0</cost>
<product id="4" name="Product A">
<code>11</code>
<shortname>ProductA</shortname>
<cost>0.4</cost>
</product>
</product>
</product>
</products>
I declare an XMLList by calling xml.children(), and bind it to a tree like so:
var products:XMLList = xml.children()
<mx:Tree id="treeProducts" dataProvider="{products}" labelField="@name" width="100%" />
However, my tree doesn't know which XML elements to create nodes for, so I get nodes for every element, ie:
-All Products - 000 - ALL - 0.0 - Product Group A - 001 - A - 0
What I really want is just to show the @name
value for each <product>
:
- All Products
- Product Group A
- Product A
Am I missing something totally obvious?