title: How to add special characters like & > in XML file using JavaScript
body: <p>I am generating XML using Javascript. It works fine if there are no special characters in the XML. Otherwise, it will generate this message: "invalid xml".</p>
  
  <p>I tried to replace some special characters, like:</p>
  
  <pre><code>xmlData=xmlData.replaceAll("&gt;","&amp;gt;");
  xmlData=xmlData.replaceAll("&amp;","&amp;amp;");
  //but it doesn't work.
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>&lt;category label='ARR Builders &amp; Developers'&gt;
  </code></pre>
  
  <p>Thanks.</p>