|
namespace WriteToXML { using System; using System.Xml; /// <summary> /// Summary description for Class1. /// </summary> public class Class1 { public Class1() {
} public static int Main(string[] args) { try { XmlTextWriter writer = new XmlTextWriter("C:\\temp\\xmltest.xml", null); writer.WriteStartDocument(); writer.WriteComment("Commentss: XmlWriter Test Program"); writer.WriteProcessingInstruction("Instruction","Person Record"); writer.WriteStartElement("p", "person", "urn:person"); writer.WriteStartElement("LastName",""); writer.WriteString("Chand"); writer.WriteEndElement(); writer.WriteStartElement("FirstName",""); writer.WriteString("Chand"); writer.WriteEndElement(); writer.WriteElementInt16("age","", 25); writer.WriteEndDocument(); } catch (Exception e) { Console.WriteLine ("Exception: {0}", e.ToString()); }
return 0; } } } |