How to modify XML with JQuery
<p>I am trying to modify a status flag in an XML structure using Javascript. Using examples found on the internet I believe this should work: </p>

<pre><code>test = "&lt;?xml version='1.0' encoding='utf-8' standalone='no' ?&gt;" + 
    "&lt;resultaat&gt;" +
        "&lt;type&gt;6&lt;/type&gt;" +
        "&lt;status&gt;I&lt;/status&gt;" +
        "&lt;start_datum&gt;2012-06-16 00:00:00&lt;/start_datum&gt;" +
        "&lt;eind_datum&gt;&lt;/eind_datum&gt;" +
    "&lt;/resultaat&gt;"
</code></pre>

<p>To change the content of the status field: </p>

<pre><code>$(test).find("status").text("D")
</code></pre>

<p>The result is however that test is not modified and still contains the old status <code>I</code></p>

<p><strong>Thanks for the answers</strong></p>

<p>The correct insight is that you need to convert to an XMLObject first and modify this.</p>

<p>Below is how I ended up doing it: </p>

<pre><code>/* Convert Text to XML Object */
doc = $.parseXML(test)

/* Change the fields required */
$(doc).find('status').text('D')

/* Back to Text */
str = (new XMLSerializer()).serializeToString(doc);
</code></pre>
