2 Replies Latest reply on Jul 16, 2009 3:03 AM by Venkat,Flex Developer

    Parsing the xml data from HTTPService

    Venkat,Flex Developer

      Hi,

           I can receive a xml format data from my HTTPService. But i want to set those values in a TREE structure (<mx:tree>) through dataprovider attribute. How can I parse the xml values and set to tree? I am using Flex 2. Please help me.

        • 1. Re: Parsing the xml data from HTTPService
          Madhav Subedi Level 4

          I suggest you to generate the xml in backend itself in a tree format.

          • 2. Re: Parsing the xml data from HTTPService
            Venkat,Flex Developer Level 1

            Hi,

             

                Yes i am already receiving my data as in the tree format from my JSP page using JSTL keys.

            For example as below:

             

                 <node label="AAAAAAA" data="Mf">
                        <node label="BBBBBB" data="Sf1">
                            <node label="G" data="Sf2"/>
                            <node label="H" data="Sf2"/>
                            <node label="I" data="Sf2"/>
                        </node>
                        <node label="CCCCCCC" data = "Sf1">
                            <node label="J" data="Sf2"/>
                            <node label="K" data="Sf2"/>
                        </node>
                        <node label="EEEEEE" data = "Sf1"/>
                        <node label="FFFFFF" data = "Sf1"/>
                    </node> 

            I am using the data value in my code internal purpose.

            I am getting the result like as above from my HTTPService attributes, result = "actionscriptmethod(event)"
            and resultFormat = "e4x"

            then i defined the method actionscriptmethod in actionscript like below

            public function treexml(eve:ResultEvent):void{
                           var xmllistcol:XMLList = new XMLList(eve.result.valueOf());
                                          
                      }

            and set the value to tree as below:

            <mx:VBox  width="100%" height="100%">
                <mx:Tree id="mytree" width="100%"
                      dataProvider="{xmllistcol}" showRoot="false"
                      height="100%">          
                </mx:Tree>

            Result is I am just getting the exact texts in the browser from my httpservice result while try to access.
            So  I cannot access the tree format

            -------- help me please