6 Replies Latest reply on Sep 9, 2008 4:22 AM by nagarjunaakkineni

    Xml Attributes with ADG

    Level 1

      Hi all,
      i'm new to flex.I have a problem regarding XML attributes."How to get the XML attribute value from the xml file to Flex application using HTTPService".I tried but it is coming only one attribute value.

      First i have to get the attribute values from the XML file and display in AdvancedDataGrid with tree structure.
      Here i will send my XML file and MXML file...
      Can u see and check my code............plzzz

      XML file................

      <?xml version="1.0" encoding="UTF-8"?>
      <todolist>
      <folder state="" label="Today todo list" isBranch="true" >

      <folder cat="Travel" state="High" duedate="3/09/2008" isBranch="false" label="book tickets" />
      <folder cat="Social" state="Low" duedate="4/09/2008" isBranch="false" label="Meeting at 7pm" />

      <folder state="" isBranch="true" label="Home " >

      <folder cat="Home" state="High" duedate="3/09/2008" isBranch="false" label="Pay power bill" />
      <folder cat="Home" state="High" duedate="3/09/2008" isBranch="false" label="Pay rent" />
      <folder cat="Home" state="Low" duedate="3/09/2008" isBranch="false" label="Call parents" />
      <folder cat="Home" state="Low" duedate="3/09/2008" isBranch="false" label="Attend John birthday party" />
      <folder cat="Home" state="Medium" duedate="3/09/2008" isBranch="false" label="Special Updates" />
      <folder cat="Home" state="high" isBranch="false" label="get Dr. appointment" />

      </folder>

      <folder state="" isBranch="true" label="Office " >

      <folder cat="Off" state="High" isBranch="false" label="Meeting at 5pm" />
      <folder cat="Off" state="Low" isBranch="false" label="Complete document and send to client" />
      <folder cat="Off" state="Low" isBranch="false" label="Interviews and Transcripts" />
      <folder cat="Off" state="High" isBranch="false" label="Set Deployment machine" />
      <folder cat="Off" state="High" isBranch="false" label="send status reports" />

      </folder>

      </folder>
      </todolist>


      MXML file............

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      initialize="adgService.send()">

      <mx:HTTPService id="adgService" url="adg.xml"/>
      <mx:AdvancedDataGrid dataProvider="{adgService.lastResult.todolist.folder}">
      <mx:columns>
      <mx:AdvancedDataGridColumn headerText="Name" dataField="label"/>
      <mx:AdvancedDataGridColumn headerText="Age" dataField="state"/>
      </mx:columns>
      </mx:AdvancedDataGrid>

      </mx:Application>

      Thnaks & Regards
      edeewan
        • 1. Re: Xml Attributes with ADG
          Level 7

          "edeewan" <webforumsuser@macromedia.com> wrote in message
          news:ga2tre$dnb$1@forums.macromedia.com...
          > Hi all,
          > i'm new to flex.I have a problem regarding XML attributes."How to
          > get
          > the XML attribute value from the xml file to Flex application using
          > HTTPService".I tried but it is coming only one attribute value.
          >
          > First i have to get the attribute values from the XML file and display in
          > AdvancedDataGrid with tree structure.
          > Here i will send my XML file and MXML file...
          > Can u see and check my code............plzzz
          >
          > XML file................
          >
          > <?xml version="1.0" encoding="UTF-8"?>
          > <todolist>
          > <folder state="" label="Today todo list" isBranch="true" >
          >
          > <folder cat="Travel" state="High" duedate="3/09/2008" isBranch="false"
          > label="book tickets" />
          > <folder cat="Social" state="Low" duedate="4/09/2008" isBranch="false"
          > label="Meeting at 7pm" />
          >
          > <folder state="" isBranch="true" label="Home " >
          >
          > <folder cat="Home" state="High" duedate="3/09/2008" isBranch="false"
          > label="Pay power bill" />
          > <folder cat="Home" state="High" duedate="3/09/2008" isBranch="false"
          > label="Pay rent" />
          > <folder cat="Home" state="Low" duedate="3/09/2008" isBranch="false"
          > label="Call parents" />
          > <folder cat="Home" state="Low" duedate="3/09/2008" isBranch="false"
          > label="Attend John birthday party" />
          > <folder cat="Home" state="Medium" duedate="3/09/2008"
          > isBranch="false"
          > label="Special Updates" />
          > <folder cat="Home" state="high" isBranch="false" label="get Dr.
          > appointment" />
          >
          > </folder>
          >
          > <folder state="" isBranch="true" label="Office " >
          >
          > <folder cat="Off" state="High" isBranch="false" label="Meeting
          > at
          > 5pm" />
          > <folder cat="Off" state="Low" isBranch="false" label="Complete
          > document and send to client" />
          > <folder cat="Off" state="Low" isBranch="false"
          > label="Interviews
          > and Transcripts" />
          > <folder cat="Off" state="High" isBranch="false" label="Set
          > Deployment
          > machine" />
          > <folder cat="Off" state="High" isBranch="false" label="send status
          > reports" />
          >
          > </folder>
          >
          > </folder>
          > </todolist>
          >
          >
          > MXML file............
          >
          > <?xml version="1.0" encoding="utf-8"?>
          > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          > layout="absolute"
          > initialize="adgService.send()">
          >
          > <mx:HTTPService id="adgService" url="adg.xml"/>
          > <mx:AdvancedDataGrid
          > dataProvider="{adgService.lastResult.todolist.folder}">
          > <mx:columns>
          > <mx:AdvancedDataGridColumn headerText="Name" dataField="label"/>
          > <mx:AdvancedDataGridColumn headerText="Age" dataField="state"/>
          > </mx:columns>
          > </mx:AdvancedDataGrid>
          >
          > </mx:Application>
          >
          > Thnaks & Regards
          > edeewan

          Try

          <mx:AdvancedDataGrid dataProvider="{adgService.lastResult.folder}">


          • 2. Re: Xml Attributes with ADG
            Level 1
            It is not working sir.Before " folder tag todolist tag is there know ,the program only one label displaying 'Today todo list' " and there is no tree structure also.
            Tel me what i have to do...............

            Thanks & Regards,
            edeewan
            • 3. Re: Xml Attributes with ADG
              Level 7

              "edeewan" <webforumsuser@macromedia.com> wrote in message
              news:ga3811$nog$1@forums.macromedia.com...
              > It is not working sir.Before " folder tag todolist tag is there know ,the
              > program only one label displaying 'Today todo list' " and there is no tree
              > structure also.
              > Tel me what i have to do...............

              Look at GroupingCollection in the help.


              • 4. Re: Xml Attributes with ADG
                Level 1
                Anybody help me plzz................
                i need the code urgently.....
                Anybody...........

                Thanks
                edeewan
                • 5. Re: Xml Attributes with ADG
                  aquarezia Level 1
                  Haha... your xml is incorrect :)

                  <folder state="" label="Today todo list" isBranch="true" >

                  this is not closed

                  it should be
                  <folder state="" label="Today todo list" isBranch="true" />
                  • 6. Re: Xml Attributes with ADG
                    Level 1
                    hey aquarezia,
                    See whole xml file clearly and tel me the answer yaar...


                    Thanks
                    srinu