To write an Xml file using Xml Writer, you need to import the namespace that is
Because the XmlWriter and XmlTextWriter classes are defined in that namespace.
So for creation of an Xml file, you need to have the constructor of the XmlTextWriter class.
After that you just create a xml file in your application as "SampleTestXml.xml" in the directory like "E:\XmlApplication"
XmlTextWriter xmlWriter = new XmlTextWriter("E:\\XmlApplication\SampleTestXml.xml", null);
If you want to display the xml content, then pass the Console.Out as a parameter of the constructor.
XmlTextWriter writer = new XmlTextWriter(Console.Out);