Mega Code Archive

 
Categories / C# Tutorial / XML
 

Read and write XML document

using System; using System.Collections; using System.Data; using System.Xml; class MainClass{   public static void Main(){     XmlDocument doc = new XmlDocument();     // read      doc.Load( "Sample.xml" );     Console.WriteLine(doc.OuterXml);     // write     XmlTextWriter tw = new XmlTextWriter( "testOut.xml", null );   tw.Formatting = Formatting.Indented;   tw.Indentation = 4;   doc.Save( tw );   tw.Close();            } } NewtongravityCuriera dioactivitySteve Irwinthey bite!