Writing XML with the XmlWriter Class : XML Write : XML C# Source Code


Custom Search

C# Source Code » XML » XML Write »

 

Writing XML with the XmlWriter Class









    


using System;
using System.IO;
using System.Xml;
   
class MainClass
{
    static public void Main()
    {
        XmlTextWriter XmlWriter = new XmlTextWriter(Console.Out);
        
        XmlWriter.WriteStartDocument();
        XmlWriter.WriteComment("This is the comments.");
        XmlWriter.WriteStartElement("BOOK");
        XmlWriter.WriteElementString("TITLE", "this is the title.");
        XmlWriter.WriteElementString("AUTHOR", "I am the author.");
        XmlWriter.WriteElementString("PUBLISHER", "who is the publisher");
        XmlWriter.WriteEndElement();
        XmlWriter.WriteEndDocument();
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo XML
» XML Write