XmlWriter
In this chapter you will learn:
Create XML file
using System;// j av a2 s . com
using System.Data;
using System.Text;
using System.Xml;
public class MainClass
{
public static void Main()
{
XmlWriter writer;
writer = XmlWriter.Create("output.xml");
writer.WriteStartDocument();
writer.WriteStartElement("pubs");
writer.WriteStartElement("titles");
writer.WriteStartAttribute("name");
writer.WriteValue("value");
writer.WriteEndAttribute();
writer.WriteStartAttribute("price");
writer.WriteValue(19.99);
writer.WriteEndAttribute();
writer.WriteEndElement();
writer.WriteEndElement();
writer.Close();
}
}
Next chapter...
What you will learn in the next chapter: