title: How do I prevent jQuery from inserting the 'xmlns' attribute in an XML object?
body: <p>I've been using the new <code>$.parseXML()</code> method with jQuery 1.5.  Whenever I insert a new element into the XML object, that new element automatically gets the 'xmlns' attribute with the value "http://www.w3.org/1999/xhtml".  For example, see the code snippet below:</p>
  
  <pre><code>var myXml = "&lt;one attr='a'&gt;&lt;two attr='b'/&gt;&lt;three attr='c'&gt;&lt;four attr='d'/&gt;&lt;/three&gt;&lt;/one&gt;";
  myXml = $.parseXML(myXml);
  $(myXml).find('three').append($('&lt;five&gt;some value&lt;/five&gt;'));
  </code></pre>
  
  <p>The code creates the following element:</p>
  
  <pre><code>&lt;five xmlns="http://www.w3.org/1999/xhtml"&gt;some value&lt;/five&gt;
  </code></pre>
  
  <p>How do I prevent jQuery from inserting the 'xmlns' attribute?  I've tried using the <code>.removeAttr()</code> method, but not even that seems to work.  Any ideas?</p>
  
  <p>UPDATE:
  The suggestion that user nrabinowitz offered was helpful in solving this problem.  Adding an xlmns attribute to the top level element does prevent the xlmns attribute from getting automatically assigned to each new element.  Still, I opted for another solution for my particular program.  I instead used the <code>.replace()</code> method to remove all the xlmns attributes after after I converted the XML object back into a string (to be displayed on a web page).</p>