title: XmlDocument throwing "An error occurred while parsing EntityName"
body: <p>I have a function where I am passing a string as params called filterXML which contains '&amp;' in one of the properties. </p>
  
  <p>I know that XML will not recognize it and it will throw me an err. Here is my code:</p>
  
  <pre><code> public XmlDocument TestXMLDoc(string filterXml)
  {
      XmlDocument doc = new XmlDocument();
      XmlNode root = doc.CreateElement("ResponseItems");
  
      // put that root into our document (which is an empty placeholder now)
      doc.AppendChild(root);
  
      try
      {
          XmlDocument docFilter = new XmlDocument();
          docFilter.PreserveWhitespace = true;
  
          if (string.IsNullOrEmpty(filterXml) == false)
              docFilter.LoadXml(filterXml); //ERROR THROWN HERE!!!
  </code></pre>
  
  <p>What should I change in my code to edit or parse filterXml? My filterXml looks like this:</p>
  
  <pre><code>&lt;Testing&gt;
  &lt;Test&gt;CITY &amp; COUNTY&lt;/Test&gt;
  &lt;/Testing&gt;
  </code></pre>
  
  <p>I am changing my string value from &amp; to &amp;. Here is my code for that:</p>
  
  <pre><code>string editXml = filterXml;
      if (editXml.Contains("&amp;"))
      {
          editXml.Replace('&amp;', '&amp;amp;');
      }
  </code></pre>
  
  <p>But its giving me an err on inside the if statement : Too many literals. </p>