Read and write XML document : XmlTextReader : XML C# Examples


C# Examples » XML » XmlTextReader »

 

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();
                
    }

}
    
   
  
   



Output

NewtongravityCuriera
dioactivitySteve Irwinthey bite!very>


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo XML
» XmlTextReader