Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }