I am trying to display xml data in a tree but can't get the xml to 
correctly populate the Tree because of the namespace in front of the 
attributes. 
Here is the xml I am getting back:
 <ns2:getProductsResponse 
xmlns:ns2="http://service.xxx.xx.xx.xx.xx.xx/";>
         <return ns2:size="344" ns2:name="Products" ns2:link="Products">
            <product ns2:name="WEATHER" ns2:link="WEATHER">
               <product ns2:name="ANALYSES" ns2:link="WEATHER.ANALYSES">
                  <product ns2:name="CYCLONE" 
ns2:link="WEATHER.ANALYSES.CYCLONE"/>
               </product>
            </product>
         </return>
      </ns2:getProductsResponse>

The tree is defined (I have tried both @name and @ns2:name):

<mx:Tree id="Tree" width="100%" height="100%" 
        labelField="@name" 
        change="treeChanged(event)"
        themeColor="#990000"
        folderClosedIcon="@Embed(source='images/marble.png')"
        folderOpenIcon="@Embed(source='images/marble.png')"
        defaultLeafIcon="@Embed(source='images/marble.png')"            
        dragEnabled="true"
        dragMoveEnabled="false" visible="true"/>

Here is my code to get the xml:

public function getProductsResult(resultObj:Object):void
{
private var ns2:Namespace = new Namespace
("http://service.xxx.xx.xx.xx.xx.xx/";);
default xml namespace = ns2;
var xml:XMLListCollection = new XMLListCollection(new XMLList
(resultObj.result));
var productsXML:XMLListCollection = new XMLListCollection(xml.children
());
}

productsXML contains everything under the ns2:getProductsResponse 
element.

Any ideas would be greatly appreciated.
Thanks,
Amanda


Reply via email to