title: Using jQuery to set values in an XML string
body: <p>I receive the following XML-like string via an $.ajax() get. Because it's not valid I cannot use dataType:'xml' or parse with $.parseXML(). Using the xml as a string though and using jQuery to traverse it seems to work ok. I can use the find() method to read the attributes but I cannot seem to set a value. (I can only get the XML, it is provided by another dept and I have no way of changing it.)</p>
  
  <p>TLDR: Need to manipulate an xml string. Add user, password, and type values so it can be sent back to the server.</p>
  
  <pre><code>var xml = '&lt;attrs xmlns="http://www.blah.com/abc/wxyz"&gt;&lt;attr name="user" type="string"/&gt;&lt;attr name="password" type="string"/&gt;&lt;attr name="type" type="string" possibilities="typeOne,typeTwo,typeThree,typeFour"&gt;typeOne&lt;/attr&gt;&lt;/attrs&gt;';
  
  /*
  &lt;attrs xmlns="http://www.blah.com/abc/wxyz"&gt;
    &lt;attr name="user" type="string"/&gt;
    &lt;attr name="password" type="string"/&gt;
    &lt;attr name="type" type="string" possibilities="typeOne,typeTwo,typeThree,typeFour"&gt;typeOne&lt;/attr&gt;
  &lt;/attrs&gt;
  */
  
  // The following works fine. I get the possibilites, split them, and add them to a form:
  $.each( $(xml).find('attr[possibilities]').attr('possibilities').split(','), function(index,value){
    options += '&lt;option value="'+value+'"&gt;'+value+'&lt;/option&gt;';
  });
  
  // I have tried the text(), prop(), and attr() methods. From what I've read you are supposed to use prop() instead of attr for setting values, but I tried attr anyway.
  $(xml).find('attr[name=user]').attr( 'textContent', 'TEST' );
  $(xml).find('attr[name=user]').text( 'TEST' );  
  $(xml).find('attr[name=user]').prop( 'textContent', 'TEST' );
  
  // After attempting attr, text, and prop, the textContent property shows nothing (not undefined):
  console.log( 'textContent ' + $(xml).find('attr[name=user]').prop('textContent') );
  </code></pre>
  
  <p>I'm relatively new at this, so it's possible my selector is just wrong. Any help is appreciated. Thanks in advance. </p>