1 Reply Latest reply on Jun 16, 2009 11:43 AM by Handycam

    How would you handle this XML?

    Handycam Level 1

      I am making an application that is a wizard-like calculator, with a series of steps that ask the user to select an item from a list.  Depending on the selections, at the end I display some information.  Straightforward.

       

      The app's content is 3 "sections" of 7 questions.  So the user does section 1, all 7 questions, then moves on to section 2 question 1 and so on.

       

      So I have structured the data into an XML file like:

       

      <group name="Demoliton and Structural Changes">
      <step name="Kitchen access">
      <items>
           <item>Direct; less than 3 ft. above grade</item>
           <item>Direct; one story above grade</item>
           <item>Indirect; less than 3 ft. above grade</item>
           <item>Indirect; one story above grade</item>
           <item>Indirect; more than one story above grade</item>
      </items>
      <tip title="Kitchen access ">Direct access to the kitchen from a parking/loading area speeds debris removal and material delivery.</tip>
      </step>
      ...more steps...
      </group>
      
      

      First of all, does this make sense as a structure to you?  It did to me, but it's easy to fix.

       

      Anyway, I get this data currently as E4X and process the RPC result as:

       

      [Bindable] public var sec1list1:XMLListCollection;
      
      
      
      private function processData(e:ResultEvent):void{
           var list1:XMLList = new XMLList(e.result..group[0]);
           sec1list1 = new XMLListCollection(list1.step[0]..item);
      }
      
      ...
      <!-- list for section one question one -->
      <s:List dataProvider="{sec1list1}"/>
      
      
      

       

      My issue is, do I have to make a bindable XMLListCollection for every list in the app this way?  I was hoping to create one list collection and then refer to it in each list via e4x notation.

       

      Any ideas?

        • 1. Re: How would you handle this XML?
          Handycam Level 1

          FWIW, I did an XMLList for each section, and a loop for each:

          
          

           

           

          public var section1:XMLList;
          public var section2:XMLList;
          public var section3:XMLList;
          
          private function processData(e:ResultEvent):void{
               var section1:XMLList = new XMLList(e.result..group[0]);
              for (var i:uint=0; i<7; i++){
                  with (this["panel"+i]){
                       stepList.dataProvider = new XMLListCollection(section1.step[i]..item);
                  }
              }
          }