1 Reply Latest reply on Jun 11, 2008 8:48 AM by G_Bruno

    Parse XML

    G_Bruno Level 1
      I am using a XMLListCollection and I what I would like to do is split up my xml into separate xmlList objects. What I would like to do is put the channel sections into their own XMLList objects and then have my datagrid loop through the item sections. I have the xml in a XMLListCollection, but I have gone through the available options for the collection and can't seem to split the xml up the way I would like to. Does anyone have any idea on how I can do this?

      The xml I have is the following:
      <?xml version="1.0" encoding="UTF-8" ?>
      - <rss version="2.0" xmlns:fd=" http://www.federalreservebenefits.org/rss/">
      - <channel>
      <title>Smart Benefits Thrift Plan Daily Unit Values for Jun. 9, 2008</title>
      <link> http://www.federalreservebenefits.org/index.cfm</link>
      <description>Thrift Plan Daily Units Values</description>
      - <item>
      <title>Equity Index</title>
      <description>$15.3064</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Government Securities</title>
      <description>$14.9507</description>
      <change>-0.50%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Equity</title>
      <description>$13.6082</description>
      <change>-0.17%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Small Company Equity</title>
      <description>$13.2332</description>
      <change>-0.56%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>International Equity</title>
      <description>$18.4284</description>
      <change>-0.57%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      </channel>
      - <channel>
      <title>Smart Benefits Thrift Plan Monthly Unit Values for May</title>
      <link> http://www.federalreservebenefits.org/index.cfm</link>
      <description>Thrift Plan Monthly Units Values</description>
      - <item>
      <title>Fixed Income</title>
      <description>$18.6270</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Stable Asset Allocation Fund</title>
      <description>$10.4242</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Conservative Asset Allocation Fund</title>
      <description>$10.3086</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Moderate Asset Allocation Fund</title>
      <description>$10.1803</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Growth Asset Allocation Fund</title>
      <description>$9.9649</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      - <item>
      <title>Aggressive Growth Asset Allocation Fund</title>
      <description>$9.8611</description>
      <change>0.00%</change>
      <link> http://www.federalreservebenefits.org/thriftplan_duv.cfm</link>
      </item>
      </channel>
      </rss>
        • 1. Re: Parse XML
          G_Bruno Level 1
          I figured it out. I did something like the following:

          private function xmlStateResultHandler(event:ResultEvent):void
          {
          populationData = event.result as XML;
          xmlList = populationData.children();
          xmlDailyList = xmlList[0].descendants("item");
          xmlMonthlyList = xmlList[1].descendants("item");
          }