title: How to create a Xml Document from a fully escaped Xml string?
body: <p><strong>Question Background:</strong></p>
  
  <p>I have an XML response from a web service (that I am unable to control the content of) that I would like to validate. For example, often the response will have a URL in it that has query string parameters using a "&amp;".</p>
  
  <p><strong>Code:</strong></p>
  
  <p>The following code gives an example of escaping an XML string with illegal characters. This will indeed produce an escaped string:</p>
  
  <pre><code>string xml = "&lt;node&gt;it's my \"node\" &amp; i like it&lt;node&gt;";
  string encodedXml = System.Security.SecurityElement.Escape(xml);
  
  // RESULT: &amp;lt;node&amp;gt;it&amp;apos;s my &amp;quot;node&amp;quot; &amp;amp; i like it&amp;lt;node&amp;gt;
  </code></pre>
  
  <p>If I know attempt to load this escaped XML into a new Xml Document, I will receive an error that the first character of the XML is not valid:</p>
  
  <pre><code>var doc = new XmlDocument();
  
  // Error will occur here.
  doc.LoadXml(encodedXml);
  </code></pre>
  
  <p>Error output:</p>
  
  <pre><code>Data at the root level is invalid. Line 1, position 1.
  </code></pre>
  
  <p><strong>How do I load this escaped XML into an XML Document object?</strong></p>