title: Javascript XML Data to Associative Array
body: <p>I have XML data which looks like this:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='ISO-8859-1'?&gt;
  &lt;cocktail_list&gt;
  &lt;cocktail&gt;
  &lt;name&gt; Blue Hawaiian &lt;/name&gt;
  &lt;ingredient&gt;
  &lt;quantity&gt;1&lt;/quantity&gt;
  &lt;shot&gt;White Rum&lt;/shot&gt;
  &lt;/ingredient&gt;
  &lt;ingredient&gt;
  &lt;quantity&gt;1&lt;/quantity&gt;
  &lt;shot&gt;Blue Curacao&lt;/shot&gt;
  &lt;/ingredient&gt;
  &lt;ingredient&gt;
  &lt;quantity&gt;2&lt;/quantity&gt;
  &lt;shot&gt;Pineapple Juice&lt;/shot&gt;
  &lt;/ingredient&gt;
  &lt;ingredient&gt;
  &lt;quantity&gt;1&lt;/quantity&gt;
  &lt;shot&gt;Coconut Cream&lt;/shot&gt;
  &lt;/ingredient&gt;
  &lt;/cocktail&gt;
  &lt;cocktail&gt;...
  &lt;/cocktail_list&gt;
  </code></pre>
  
  <p>Using Javascript I would like to create a nested/associative array (or using objects) to look like:
  arrayName[Blue Hawaiian[White Rum => 1, Blue Curaco => 2, Pineapple Juice => 1...], name[shot => quantity, ...]]</p>
  
  <p>Now I know how to iterate through my XML, however I don't know how best to convert this into my array.</p>
  
  <p>Any help would be appreciated.</p>