title: Parsing XML or JSON with Jquery
body: <p>I have a fairly large XML file (around 42MB) that I am parsing with jquery. I need to selectively show certain nodes based on an ID. By doing this the web browser becomes unresponsive, and the average time for parsing is greater than 15 seconds. </p>
  
  <p>My query is whether converting this large XML file to JSON, help improve the performance? Below is a sample of the XML.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE thesaurus SYSTEM "Thesaurus_1_4.dtd"&gt;
  &lt;thesaurus action="ExportLanguage" language="en" version="2.7" date="2011-08-15"&gt;
    &lt;options/&gt;
    &lt;wordblocks&gt;
      &lt;wordblock&gt;
        &lt;term type="forbidden" lang="en" termid="18297"&gt;
          &lt;value&gt;1,1-DIETHOXYETHANE&lt;/value&gt;
        &lt;/term&gt;
        &lt;terms&gt;
          &lt;term rel="USE" lang="en" termid="30" type="valid"&gt;
            &lt;value&gt;ACETAL&lt;/value&gt;
          &lt;/term&gt;
        &lt;/terms&gt;
      &lt;/wordblock&gt;
      &lt;wordblock&gt;
        &lt;term type="forbidden" lang="en" termid="18307"&gt;
          &lt;value&gt;1,2,3-PROPANETRIOL&lt;/value&gt;
        &lt;/term&gt;
        &lt;terms&gt;
          &lt;term rel="USE" lang="en" termid="4028" type="valid"&gt;
            &lt;value&gt;GLYCEROL&lt;/value&gt;
          &lt;/term&gt;
        &lt;/terms&gt;
      &lt;/wordblock&gt;
      &lt;wordblock&gt;
        &lt;term type="forbidden" lang="en" termid="18308"&gt;
          &lt;value&gt;1,2,3-TRIHYDROXYBENZENE&lt;/value&gt;
        &lt;/term&gt;
        &lt;terms&gt;
          &lt;term rel="USE" lang="en" termid="8094" type="valid"&gt;
            &lt;value&gt;PYROGALLOL&lt;/value&gt;
          &lt;/term&gt;
        &lt;/terms&gt;
      &lt;/wordblock&gt;
      &lt;wordblock&gt;
        &lt;term type="forbidden" lang="en" termid="18309"&gt;
          &lt;value&gt;1,2,4,5-TETRAMETHYLBENZENE&lt;/value&gt;
        &lt;/term&gt;
        &lt;terms&gt;
          &lt;term rel="USE" lang="en" termid="2814" type="valid"&gt;
            &lt;value&gt;DURENE&lt;/value&gt;
          &lt;/term&gt;
        &lt;/terms&gt;
      &lt;/wordblock&gt;
      &lt;wordblock&gt;
        &lt;term type="forbidden" lang="en" termid="18298"&gt;
          &lt;value&gt;1,2-DIHYDROXYANTHRAQUINONE&lt;/value&gt;
        &lt;/term&gt;
        &lt;terms&gt;
          &lt;term rel="USE" lang="en" termid="229" type="valid"&gt;
            &lt;value&gt;ALIZARIN&lt;/value&gt;
          &lt;/term&gt;
        &lt;/terms&gt;
      &lt;/wordblock&gt;
  &lt;/wordblocks&gt;
  &lt;/thesaurus&gt;
  </code></pre>
  
  <p>and here's the ajax call to the XML</p>
  
  <pre><code>LoadRelatedTerms = function (term) {
      $.ajax({
          type: "GET",
          url: "THESAURUS.xml",
          dataType: "xml",
          success: function (xml) {
              $('.items').html('');
              $(xml).find('wordblock').each(function () {
                  $(this).children('term').each(function () {
                      var value = $(this).find('value').text();
                      if (value == term) {
                          $(this).parent().children('terms').children('term[level=1]').each(function () {
                              var id = $(this).attr('id');
                              var termValue = $(this).find('value').text();
                              $('&lt;div class="items" id="term' + id + '"&gt;&lt;/div&gt;').html(termValue).appendTo('#page-wrap');
                          });
                          return false;
                      }
                  });
              });
          }
      });
  </code></pre>