I\'m trying to read in an XML configuration file, do a few tweaks (finding and removing or adding an element) and save it again. I want this edit to be as non-intrusive as possi
To avoid the declaration in the header of the document you can use the following
XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; using (XmlWriter xw = XmlWriter.Create(fileName, settings)) { doc.Save(xw); }