using System;
using System.IO;
using System.Xml;
public class Sample {
private const string filename = "sampledata.xml";
public static void Main() {
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter writer = XmlWriter.Create(filename, settings);
String PItext="type=\"text/xsl\" href=\"book.xsl\"";
writer.WriteProcessingInstruction("xml-stylesheet", PItext);
writer.WriteDocType("book", null , null, "");
writer.WriteComment("sample XML");
writer.WriteStartElement("book");
writer.WriteAttributeString("genre", "Computer");
writer.WriteAttributeString("ISBN", "1-111111-111");
writer.WriteElementString("title", "XML");
writer.WriteStartElement("style");
writer.WriteEntityRef("h");
writer.WriteEndElement();
writer.WriteElementString("price", "9.9");
writer.WriteCData("Prices 15% off!!");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
}