/// <summary> /// The System XML writer includes an XML declaration by default, however this is often not desired. /// An XML writer can be created with settings specifying to omit the XML declaration, but other settings must be set to get the desired default behavior. /// This method produces an XML writer that omits the declaration. /// </summary> public static XmlWriter NewOmitDeclaration(Stream stream) { var settings = XmlWriterSettingsHelper.GetNoDeclaration(); var writer = XmlWriter.Create(stream, settings); return(writer); }
/// <summary> /// Gets the standard XML writer settings. /// </summary> public static XmlWriterSettings GetStandardSettings() { var settings = XmlWriterSettingsHelper.GetNoDeclaration(); settings.Encoding = new UTF8Encoding(false); settings.Indent = true; return(settings); }