2 Replies Latest reply on Aug 26, 2008 5:20 AM by whertzing

    Need to get a "slice" of an XMLList

    whertzing
      I get an XMLList from a Web Service by parsing the results of a web service call using event.result..Period, which gives an XMLList where each node has an attribute "PeriodStart" whose value is a datetime string.

      I want to use a slider (which returns integers for the slider start and end location(s) within the max and min integers) to select just a "slice" of these nodes. If my data werre an Array, I could use the array.slice(x,z) method to get the elements with index values between the the start and end integers.

      Is there a (simple) way to get the nodes of an XMLList between two integers? That is, if there were 10 nodes in the XMLList, and an implicit ordering to the nodes based on the value of the attribute @PeriodStart, and I wanted to get the 3rd through 7th node (a "slice" consiting of 5 nodes), how can I express this in ActionSCript?

      Thanks!
        • 1. Re: Need to get a "slice" of an XMLList
          Level 7

          "whertzing" <webforumsuser@macromedia.com> wrote in message
          news:g8hgia$iaq$1@forums.macromedia.com...
          >I get an XMLList from a Web Service by parsing the results of a web service
          > call using event.result..Period, which gives an XMLList where each node
          > has an
          > attribute "PeriodStart" whose value is a datetime string.
          >
          > I want to use a slider (which returns integers for the slider start and
          > end
          > location(s) within the max and min integers) to select just a "slice" of
          > these
          > nodes. If my data werre an Array, I could use the array.slice(x,z) method
          > to
          > get the elements with index values between the the start and end integers.
          >
          > Is there a (simple) way to get the nodes of an XMLList between two
          > integers?
          > That is, if there were 10 nodes in the XMLList, and an implicit ordering
          > to the
          > nodes based on the value of the attribute @PeriodStart, and I wanted to
          > get the
          > 3rd through 7th node (a "slice" consiting of 5 nodes), how can I express
          > this
          > in ActionSCript?

          Use an XMLListCollection with a filterFunction.


          • 2. Re: Need to get a &quot;slice&quot; of an XMLList
            whertzing Level 1
            Thank you for that pointer. The filterFunction was a bit tricky, I had to "store away" the value of the key attribute for the 3rd node and the 7th node in the slider, then filter the XMLList on "all values of the key attribute between the 3rd and 7th node, inclusive).