WELCOME TO SILVERLIGHT

DARE TO BE DIFFERENT

Tuesday, April 28, 2009

How to Save in XML file?

You can save to a file, a TextWriter, or an XmlWriter.
For example, to save the XDocument contents to a file named Bookstore.xml,
you can write:


C# Coding:

private void btnSaveXML_Click(object sender, EventArgs e)
{
XDocument bookStoreXml = new XDocument(new XDeclaration("1.0", "utf-8","yes"), new XComment("Bookstore XMLExample"), new XElement("bookstore", ---- ---- ) ); bookStoreXml.Save(@"C:\Temp\Bookstore.xml");
MessageBox.Show("Successfully saved");
}

No comments:

Post a Comment