title: write a XML document from within a c# application?
body: <p>I have a C# program that gathers system information.  All of it is complete execept writing to the xml file. I have passed <code>System version, IE version and Regedit</code> version into "ints" and "strings". Now the problem I am having is writing the output to two files:</p>
  
  <ol>
  <li><code>Sys_info.xml</code> - System info generated by the program</li>
  <li><code>unattend.xml</code> - For IIS setup, which uses the variables from the program </li>
  </ol>
  
  <p>The IIS unattended.xml is found here:
  <a href="http://learn.iis.net/page.aspx/133/using-unattended-setup-to-install-iis/" rel="nofollow">http://learn.iis.net/page.aspx/133/using-unattended-setup-to-install-iis/</a></p>
  
  <p>The sad thing is I am not a programmer and the guy who wrote this is on a vacation</p>
  
  <p>Anyhow here is the xml code for the unattended.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;unattend xmlns="urn:schemas-microsoft-com:unattend"
  xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"&gt;
  &lt;servicing&gt;
  &lt;!-- Install a selectable update in a package that is in the Windows Foundation     namespace --&gt;
  &lt;package action="configure"&gt;
    &lt;assemblyIdentity
       name="Microsoft-Windows-Foundation-Package"
       version="6.0.5308.6" ***reg version int from registry goes here(from my program)***
       language="neutral"
       processorArchitecture="x86" **** Processor architecture goes here(from my program)****
       publicKeyToken="31bf3856ad364e35"
       versionScope="nonSxS"
    /&gt;
  &lt;selection name="IIS-WebServerRole" state="true"/&gt;
  &lt;selection name="IIS-WebServer" state="true"/&gt;
  &lt;selection name="IIS-CommonHttpFeatures" state="true"/&gt;
  &lt;selection name="IIS-StaticContent" state="true"/&gt;
  &lt;selection name="IIS-DefaultDocument" state="true"/&gt;
  &lt;selection name="IIS-DirectoryBrowsing" state="true"/&gt;
  &lt;selection name="IIS-HttpErrors" state="true"/&gt;
  &lt;selection name="IIS-HttpRedirect" state="true"/&gt;
  &lt;selection name="IIS-ApplicationDevelopment" state="true"/&gt;
  &lt;selection name="IIS-ASPNET" state="true"/&gt;
  &lt;selection name="IIS-NetFxExtensibility" state="true"/&gt;
  &lt;selection name="IIS-ASP" state="true"/&gt;
  &lt;selection name="IIS-CGI" state="true"/&gt;
  &lt;selection name="IIS-ISAPIExtensions" state="true"/&gt;
  &lt;selection name="IIS-ISAPIFilter" state="true"/&gt;
  &lt;selection name="IIS-ServerSideIncludes" state="true"/&gt;
  &lt;selection name="IIS-HealthAndDiagnostics" state="true"/&gt;
  &lt;selection name="IIS-HttpLogging" state="true"/&gt;
  &lt;selection name="IIS-LoggingLibraries" state="true"/&gt;
  &lt;selection name="IIS-RequestMonitor" state="true"/&gt;
  &lt;selection name="IIS-HttpTracing" state="true"/&gt;
  &lt;selection name="IIS-CustomLogging" state="true"/&gt;
  &lt;selection name="IIS-ODBCLogging" state="true"/&gt;
  &lt;selection name="IIS-Security" state="true"/&gt;
  &lt;selection name="IIS-BasicAuthentication" state="true"/&gt;
  &lt;selection name="IIS-WindowsAuthentication" state="true"/&gt;
  &lt;selection name="IIS-DigestAuthentication" state="true"/&gt;
  &lt;selection name="IIS-ClientCertificateMappingAuthentication" state="true"/&gt;
  &lt;selection name="IIS-IISCertificateMappingAuthentication" state="true"/&gt;
  &lt;selection name="IIS-URLAuthorization" state="true"/&gt;
  &lt;selection name="IIS-RequestFiltering" state="true"/&gt;
  &lt;selection name="IIS-IPSecurity" state="true"/&gt;
  &lt;selection name="IIS-Performance" state="true"/&gt;
  &lt;selection name="IIS-HttpCompressionStatic" state="true"/&gt;
  &lt;selection name="IIS-HttpCompressionDynamic" state="true"/&gt;
  &lt;selection name="IIS-WebServerManagementTools" state="true"/&gt;
  &lt;selection name="IIS-ManagementConsole" state="true"/&gt;
  &lt;selection name="IIS-ManagementScriptingTools" state="true"/&gt;
  &lt;selection name="IIS-ManagementService" state="true"/&gt;
  &lt;selection name="IIS-IIS6ManagementCompatibility" state="true"/&gt;
  &lt;selection name="IIS-Metabase" state="true"/&gt;
  &lt;selection name="IIS-WMICompatibility" state="true"/&gt;
  &lt;selection name="IIS-LegacyScripts" state="true"/&gt;
  &lt;selection name="IIS-LegacySnapIn" state="true"/&gt;
  &lt;selection name="IIS-FTPPublishingService" state="true"/&gt;
  &lt;selection name="IIS-FTPServer" state="true"/&gt;
  &lt;selection name="IIS-FTPManagement" state="true"/&gt;
  &lt;selection name="WAS-WindowsActivationService" state="true"/&gt;
  &lt;selection name="WAS-ProcessModel" state="true"/&gt;
  &lt;selection name="WAS-NetFxEnvironment" state="true"/&gt;
  &lt;selection name="WAS-ConfigurationAPI" state="true"/&gt;
  &lt;/package&gt;
  &lt;/servicing&gt;
  &lt;/unattend&gt;
  </code></pre>