How to convert string to xml object in jquery
<p>I looked at <a href="http://stackoverflow.com/questions/1290321/convert-string-to-xml-document-in-javascript">Convert String to XML Document in JavaScript</a> but I could not found a solution in my case, can somebody help me in my situation. </p>

<p>I have a string like below, I want to convert it to an XML Object, How can I do that?</p>

<pre><code>&lt;list&gt;
&lt;Response&gt;
&lt;cfgId&gt;280&lt;/cfgId&gt;
&lt;recommendations&gt;&amp;lt;Rule&amp;gt;
&amp;lt;name&amp;gt;simple rule&amp;lt;/name&amp;gt;
&amp;lt;category&amp;gt;none&amp;lt;/category&amp;gt;
&amp;lt;severity&amp;gt;warning&amp;lt;/severity&amp;gt;
&amp;lt;ruleEvalResult&amp;gt;true&amp;lt;/ruleEvalResult&amp;gt;
&amp;lt;actionResult&amp;gt; Current value of maxfilesperproc is  32
increase it to 1024&amp;lt;/actionResult&amp;gt;
&amp;lt;/Rule&amp;gt;&lt;/recommendations&gt;
&lt;/Response&gt;
&lt;/list&gt;
</code></pre>

<p>Readable version of above xml</p>

<pre><code>&lt;list&gt;

&lt;Response&gt;
&lt;cfgId&gt;280&lt;/cfgId&gt;

&lt;recommendations&gt;
&lt;Rule&gt; &lt;name&gt;simple rule&lt;/name&gt; &lt;category&gt;none&lt;/category&gt; &lt;severity&gt;warning&lt;/severity&gt;     &lt;ruleEvalResult&gt;true&lt;/ruleEvalResult&gt; &lt;actionResult&gt;Current value of maxfilesperproc is  32
increase it to 1024&lt;/actionResult&gt; &lt;/Rule&gt;

&lt;/recommendations&gt;

&lt;/Response&gt;
&lt;/list&gt;
</code></pre>

<p><strong>Updated, Here is what i tried.</strong></p>

<pre><code>var xml;
$.post("/csm/rules.action",
  { sessiontoken:   sessiontoken,
    cfgid:          cfgid},
      function(xmldata)
      {

            xml=$(xmldata);


      }
);
var htmlTable = $('&lt;table&gt;&lt;/table&gt;');

$(xml).find('Response').each(function(){
  var cid = $(this).find('cfgId').text();
  alert(cid+", "+cfgid);
  if(cid==cfgid) {   

    // Now grab the entitiy string
    var newXmlString = $(xml).find('recommendations').text(); 
    // Convert the entities to HTML and return a jQuery object
    var newXml = $("&lt;div/&gt;").html(newXmlString);

    // NOW we can get at the inner XML
    var ruleseverity=$(newXml).find('severity').text();
    if(ruleseverity=="warning")  {
      var rulename=$(newXml).find('name').text();
      var rulecategory=$(newXml).find('category').text();
      var ruleresult=$(newXml).find('ruleEvalResult').text();
      var ruleactionresult=$(newXml).find('actionResult').text();
        htmlTable.append('&lt;tr&gt;&lt;td&gt;RuleName:'+rulename+'&lt;/td&gt;&lt;td&gt;RuleResult: '+ruleactionresult+'&lt;/td&gt;&lt;/tr&gt;');
    }           
  }
});
</code></pre>

<p>I am adding <code>htmlTable</code> later in the code <code>'&lt;div class="block"&gt;'+htmlTable+'&lt;/div&gt;'</code></p>

<p><strong>I does not alerts at all</strong></p>
