Writing XML with the XmlWriter Class

image_pdfimage_print


   


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


This entry was posted in XML-RPC. Bookmark the permalink.