CSharp examples for System.Xml:XML Document
Save Xml Document
using System.Xml; using System.Collections.Generic; using System;// w w w . jav a2s .com public class Main{ public static void SaveXmlDocument(string xmlFilePath, List<Dictionary<string, string>> elements) { XmlDocument xml = LoadXmlDocument(xmlFilePath); xml.RemoveAll(); xml = AddXmlHeader(xml, "GameList"); for (int i = 0; i < elements.Count; i++) { xml = AddElement(xml, "Game", elements[i]); } xml.Save(xmlFilePath); } public static void SaveXmlDocument(XmlDocument xml, string xmlFilePath) { xml.RemoveAll(); xml = AddXmlHeader(xml, "GameList"); xml.Save(xmlFilePath); } }