1 Reply Latest reply on Sep 29, 2009 7:26 AM by Yogi_ACE

    Find unique values + XML Traversing

    Yogi_ACE

      I have XML result:

      <Root>

      <Location>

                     <Block>Production</Block>

                     <Area>North Main</Area>

                  </Location>

                  <Location>

                     <Block>Production</Block>

                     <Area>Central</Area>

                  </Location>

                  <Location>

                     <Block>Production</Block>

                     <Area>Southern</Area>

                  </Location>

                  <Location>

                     <Block>Maintainance</Block>

                     <Area>West</Area>

                  </Location>

               </Locations>

      </Root>

      Can I find unique Block Name from above XML?
      Right now by traversing I am getting 3 "Production" and 1 "Maintainance" value.
      Question: I want to create collection as follows
      var obj:Object = new Object();
      obj.Production = "North Main | Central | Southern"; // Collection of Area's with respect to Block
      obj.Maintainance = "West";
      <Block> will be generated dynamically, so I dont want to compare it with hard coded data like,

      Array = [“Production”, “Maintainance”,  “Shop”];

      If(ARR[0] == "Production")

           obj.Production = Area;

      else

           obj.Maintainance = Area;