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();
}
}
Related examples in the same category