title: Parsing XML with ActionScript 3.0
body: <p>I have a XML which goes like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;Row&gt;
          &lt;ColumnA&gt;2013-08-07&lt;/ColumnA&gt;
          &lt;ColumnB&gt;Pizza&lt;/ColumnB&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;ColumnA&gt;2013-04-07&lt;/ColumnA&gt;
          &lt;ColumnB&gt;Burger&lt;/ColumnB&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;ColumnA&gt;2013-04-07&lt;/ColumnA&gt;
          &lt;ColumnB&gt;Pizza&lt;/ColumnB&gt;
      &lt;/Row&gt;
  </code></pre>
  
  <p>The XML goes on like this for hundreds of Rows. What I am trying to achieve is this. "Output: Pizza: 2 occurances on 2013-08-07 &amp; 2013-04-07." So far this is what I've tried:</p>
  
  <pre><code>//Variables
  var myXML:XML;
  var xmlLoader:URLLoader = new URLLoader();
  
  //Check that the XML is loaded
  xmlLoader.load(new URLRequest ("myXML.xml"));
  xmlLoader.addEventListener(Event.COMPLETE, processXML);
  function processXML(e:Event):void {
      myXML = new XML(e.target.data);
  
      //Create a XMLList for Column A data
  
      var items:XMLList = myXML.Row.ColumnA.text()
  
      //Create a XMLList for Rows
  
      var rows:XMLList = myXML.Row
  
      //Create a XMLList for Column B data (Dates)
      var dates:XMLList = myXML.Row.ColumnB.text()
  
      //Create an empty object to fill in the occurances of Column A
      var columnA:String;
      var map:Object = {};
      for each (columnA in items)
      {
          if(!map[columnA])
              map[columnA] = 1;
          else 
              map[columnA]++;
      }
  
  
      for ( columnA in map ) 
      {
          trace(columnA, "=", map[columnA], "times. On dates ");
      }
  
  }
  </code></pre>
  
  <p>My newbie attempt at trying to see if I can relate column B to column A</p>
  
  <pre><code>    var columnB:String;
  
      for ( var i:uint=0; i&lt;rows.length(); i++ )
      {
          if ( columnA[i] == myXML.Row.ColumnA[i] )
          {
              trace( columnA[i], "=", columnB[i] )
          }
      }
  </code></pre>
  
  <p>It's puzzling me. Currently in output panel I get... </p>
  
  <pre><code>Pizza 2 times. On Dates 
  Burger 1 times. On Dates
  etc.
  </code></pre>
  
  <p>Is there a way to include the dates in the trace output? So I get something like:</p>
  
  <pre><code>Pizza 2 times. On Dates 2013-08-07, 2013-04-07
  </code></pre>