title: how to parse xml with special character? specifically for ampersand
body: <p>I am getting data from text box and change it into xml format and store it in data base. For allowing special characters i wrote javascript function to replace special character with its html entities.</p>
  
  <pre><code> "     &amp;quot;
   &amp;     &amp;amp;
   &lt;     &amp;lt;
   &gt;     &amp;gt;
  </code></pre>
  
  <p>for "quotes , less than , greater than" its working fine.  for "&amp;" it is showing xml parser error 
     i used javascript to replace special character with its entity </p>
  
  <pre><code>  string.replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;').replace(/&amp;/g, '&amp;amp;').replace(/"/g, '&amp;quot;').replace(/'/g, "\\'");
  
    for "&amp;" allow showing warning but it get stored in data base. please help me to sort out this problem . 
  
  
   i begin with string.replace(/&amp;/g, '&amp;amp;') even though i am getting 
  </code></pre>
  
  <p><strong>Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : EntityRef: expecting ';' in /var/www/</strong>
         i tried this also &amp;amp;amp; as mentioned in this link <a href="https://stackoverflow.com/questions/1328538/%E2%80%A6">stackoverflow.com/questions/1328538/…</a><br>
      After that there is no warning but while saving in db it saved as "ab &amp;amp cd" </p>