Hi,

I want to convert and xml into ArrayCollection.I have tried to do it
using SimpleXMlDecoder.When I have converted the xml into
ArrayCollection I am only able to access the elements just below the
root node.I am unable to access the inner elements.
Please find the code below:

[Bindable]
public var arrColl:ArrayCollection;
[Bindable]
private var treeData:XML =
        <root>
                 <node label="CRM" data="222">
                      <test label="aaa" data="333"/>
                      <test label="bbb" data="444"/>
                      <test label="ccc" data="555"/>
                </node>
                <node label="ERP" data="666">
                     <test label="ddd" data="777"/>
                     <test label="eee" data="888"/>
                     <test label="fff" data="999"/>
                </node>
                 <node label="BI" data="000">
                     <test label="ggg" data="1010"/>
                      <test label="hhh" data="1111"/>
                    <test label="iii" data="2222"/>
                </node>
        </root>;
public function convertXMLtoArrayColl():void{
                                Alert.show("entred into the function");
                                var xmlDoc:XMLDocument = new 
XMLDocument(treeData);
                                var decoder:SimpleXMLDecoder = new 
SimpleXMLDecoder(true);
                                var data:Object = decoder.decodeXML( xmlDoc );
 
arrColl=new ArrayCollection();
 
if(data.root.hasOwnProperty("node"))
                                {
                                        if(data.root.node is ArrayCollection)
                                        {
                                                arrColl = data.root.node;
                                                                                
        }
                                        else if(data.root.node is Object)
                                        {
                                                arrColl.addItem(data.root.node);
                                                                                
        }
                                }

}

I want to access the <test> element which is there inside the node
element.
Can anyone please let me know how can I do this

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to