title: Parse nested xml with jQuery (children elements)
body: <p>First off here is the structure I'm going for:</p>
  
  <pre><code>&lt;ul&gt;
     &lt;li&gt;
        &lt;h3&gt;State Name 1&lt;/h3&gt;
        &lt;ul&gt;
           &lt;li&gt;
              &lt;a href="storeurl" id="storeid"&gt;storename&lt;/a&gt;
           &lt;/li&gt;
           &lt;li&gt;
              &lt;a href="storeurl" id="storeid"&gt;storename2&lt;/a&gt;
           &lt;/li&gt;
        &lt;/ul&gt;
     &lt;/li&gt;
     &lt;li&gt;
        &lt;h3&gt;State Name 2&lt;/h3&gt;
        &lt;ul&gt;
           &lt;li&gt;
              &lt;a href="storeurl" id="storeid"&gt;storename&lt;/a&gt;
           &lt;/li&gt;
        &lt;/ul&gt;
     &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Here's how my xml file is structured:</p>
  
  <pre><code>&lt;storeList&gt;
      &lt;state&gt;
          &lt;stateName&gt;Maine&lt;/stateName&gt;
              &lt;store&gt;
                  &lt;storeName&gt;first store&lt;/storeName&gt;
                  &lt;storeID&gt;store1&lt;/storeID&gt;
                  &lt;storeURL&gt;http://www.url.com&lt;/storeURL&gt;
              &lt;/store&gt;
              &lt;store&gt;
                  &lt;storeName&gt;second store&lt;/storeName&gt;
                  &lt;storeID&gt;store2&lt;/storeID&gt;
                  &lt;storeURL&gt;http://www.url.com&lt;/storeURL&gt;
              &lt;/store&gt;
              &lt;store&gt;
                  &lt;storeName&gt;third store&lt;/storeName&gt;
                  &lt;storeID&gt;store3&lt;/storeID&gt;
                  &lt;storeURL&gt;http://www.url.com&lt;/storeURL&gt;
              &lt;/store&gt;
      &lt;/state&gt;
      &lt;state&gt;
          &lt;stateName&gt;Connecticut&lt;/stateName&gt;
              &lt;store&gt;
                  &lt;storeName&gt;first store&lt;/storeName&gt;
                  &lt;storeID&gt;store4&lt;/storeID&gt;
                  &lt;storeURL&gt;http://www.url.com&lt;/storeURL&gt;
              &lt;/store&gt;
      &lt;/state&gt;
  &lt;/storeList&gt;
  </code></pre>
  
  <p>I'm not sure how to loop through the elements to get the nested list.
  I know how to write xml elements to the html, but I haven't done this type of nested list before.</p>
  
  <p>I tried breaking up the script to loop through the different elements, but this didn't work and I know my structure is wrong for the second part. I'm assuming I'll have to do some sort of outer or inner wrap of the ul elements?</p>
  
  <pre><code>$(document).ready(function () {
                            $.ajax({
                                type: "GET",
                                url: "xml/storeList.xml",
                                dataType: "xml",
                                success: xmlParser
                            });
                            });
  
                            function xmlParser(xml) {
  
                            $(xml).find("state").each(function () {
  
                                $(".storeListContent").append('&lt;ul&gt;&lt;li&gt;&lt;h3&gt;' +
                                  $(this).find("stateName").text() +
                                  '&lt;/h3&gt;&lt;/li&gt;&lt;/ul&gt;');
  
  
  
                            });
  
                              /*$(xml).find("store").each(function () {
                             $(".storeListContent ul li").append('&lt;ul&gt;&lt;li&gt;' +
                                  '&lt;a class="storeInactive" id="' +
                                  $(this).find("storeID").text() +
                                  '" href="' +
                                  $(this).find("stateURL").text() +
                                  '"&gt;' +
                                  $(this).find("stateName").text() +
                                  '&lt;/a&gt;' +
                                  '&lt;/li&gt;&lt;/ul&gt;'
                                  );
                              });*/
  
                            }
  </code></pre>
  
  <p><em><strong>Working:</em></strong>
  Had to change the datatype to html instead of xml.
  Anyone have insight into why that works? </p>