title: How to make XMLDOMDocument include the XML Declaration?
body: <p>When an XMLDOMDocument saves itself, how can i get it to include the <strong>XML Declaration</strong>, e.g.:</p>
  
  <ul>
  <li><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="UTF-16" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="UCS-2" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="UCS-4" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="ISO-10646-UCS-2" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="UNICODE-1-1-UTF-8" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="UNICODE-2-0-UTF-16" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="UNICODE-2-0-UTF-8" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="US-ASCII" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;</code></li>
  <li><code>&lt;?xml version="1.0" encoding="WINDOWS-1250" ?&gt;</code></li>
  </ul>
  
  <p>The XMLDOMDomcument object is being created in memory (i.e. the xml is not being loaded from some outside source):</p>
  
  <pre><code>{
     IXMLDOMDocument2 doc = new DOMDocument60();
  
     //add nodes to the doc
     ...
  
     doc.Save(saveTarget);
  }
  </code></pre>
  
  <p>Without the xml declaration you only get the body xml, e.g.: </p>
  
  <pre><code>&lt;Customer&gt;
     ...
  &lt;/Customer&gt;
  </code></pre>
  
  <p>rather than the full XML document:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="US-ASCII" ?&gt;
  &lt;Customer&gt;
     ...
  &lt;/Customer&gt;
  </code></pre>
  
  <h2>Question 2</h2>
  
  <p>How can i control the <a href="http://support.microsoft.com/kb/275883" rel="noreferrer">encoding the XMLDOMDocument</a> will use when it saves to a stream?</p>