title: How to encode/decode XML in VBA and C#
body: <p>I currently have a program that trasfer data from VBA (Access) to C# (via ASP.NET POST).  How do I encode/decode on each end?</p>
  
  <p>Here is my XML read in C#:</p>
  
  <pre><code>StreamReader reader = new StreamReader(Request.InputStream);
  string xmlData = "";
  XmlDocument xml = new XmlDocument();
  xmlData = reader.ReadToEnd();
  XmlElement rootXML;
  xml.LoadXml(xmlData);
  rootXML = xml.DocumentElement;
  </code></pre>
  
  <p>Here is my XML write in C#:</p>
  
  <pre><code>Response.Clear();
  Response.ContentType = "text/xml";
  Response.Charset = "UTF-8";
  Response.Write(XML_in_String);
  Response.End();
  </code></pre>
  
  <p>Here is my XML write in VBA</p>
  
  <pre><code>connection.Open "POST", server &amp; "www.webpage.com/" &amp; postData, False
  connection.setRequestHeader "Accept", "application/xml"
  connection.setRequestHeader "Content-Type", "application/xml"
  connection.send "&lt;?xml version=""1.0"" encoding=""UTF-8"" ?&gt;&lt;data&gt;" &amp; outXMLstr &amp; "&lt;/data&gt;"
  </code></pre>
  
  <p>Here is my XML read in VBA</p>
  
  <pre><code>Dim inXML As MSXML2.DOMDocument
  Set inXML = New DOMDocument
  inXML.loadXML (connection.responseText)
  </code></pre>
  
  <p>Specifically, I got an error in C# when trying to loadXML(xmlData) because it can't parse the ampersand (&amp;).</p>