title: Writing a System.Xml.XmlElement to a file on disk
body: <p>I'm having trouble with writing a System.Xml.XmlElement to disk using C# .NET.</p>
  
  <p>This is what I'm trying to do at the moment and failing:</p>
  
  <pre><code>XmlWriterSettings oSettings = new XmlWriterSettings();
  oSettings.Indent = true;
  oSettings.OmitXmlDeclaration = false;
  oSettings.Encoding = Encoding.ASCII;
  
  XmlWriter writer = XmlWriter.Create(@"C:\xmlfile.xml", oSettings);
  System.Xml.XmlElement xml = sc.WFCFunctionCall();
  xml.WriteContentTo(writer2);
  </code></pre>
  
  <p>the variable 'xml' definitely contains valid XML, I've stopped in the debugger and inspected.</p>
  
  <pre><code>xml.WriteTo(writer2)
  </code></pre>
  
  <p>also does not work.</p>
  
  <p>Is there a simple way of doing this?</p>
  
  <p>Cheers!
  Nick.</p>