How to

save xml document

Published: 14. January 2009 | Updated: 26. October 2011
License: Microsoft Public License (MS-PL)
Categories: Framework » XML
Tags: C# XML
Was this snippet helpful for you? YESYES / NONO

Import namespaces

using System.IO;
using System.Xml;

Code

// create instance of new xml document
XmlDocument doc = new XmlDocument();

// fill xml document

// save to file by path
doc.Save(@"C:\sitemap.xml");

// save to file stream
doc.Save(File.Create(@"C:\sitemap.xml"));
Send us feedback about this snippet »



Related Snippets: