Removing version from xml file Removing version from xml file xml xml

Removing version from xml file


Use the ConformanceLevel and OmitXmlDeclaration properties. Example:

XmlWriter w;w.Settings = new XmlWriterSettings();w.Settings.ConformanceLevel = ConformanceLevel.Fragment;w.Settings.OmitXmlDeclaration = true;


When creating your XmlWriter, pass through the settings you want using XmlWriterSettings:

XmlWriterSettings settings = new XmlWriterSettings();settings.OmitXmlDeclaration = true;writer = XmlWriter.Create(Console.Out, settings);

XmlWriterSettings has other properties as well (indent and more).