Save XML document to console and through XmlTextWriter : Xml Display « XML « C# / CSharp Tutorial






using System;
using System.Xml;

class MainClass
{
  static void Main(string[] args)
  {
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(@"C:\xmlWriterTest.xml");

    XmlTextWriter writer = new XmlTextWriter("C:\\domtest.xml", null);
    writer.Formatting = Formatting.Indented;
    xmlDoc.Save(writer);

    xmlDoc.Save(Console.Out);
  }       
   
}








30.16.Xml Display
30.16.1.Output XmlDocument to Console
30.16.2.Save XML document to console and through XmlTextWriter