System.Xml.XmlWriter.Create Method

Creates a new System.Xml.XmlWriter instance using the specified System.Xml.XmlWriter object.

Syntax

public static XmlWriter Create (XmlWriter output)

Parameters

output
The System.Xml.XmlWriter object that you want to use as the underlying writer.

Returns

An System.Xml.XmlWriter object that is wrapped around the specified System.Xml.XmlWriter object.

Remarks

This method allows you add features to an underlying System.Xml.XmlWriter object. The underlying System.Xml.XmlWriter object can be an object created by the erload:System.Xml.XmlWriter.Create method, or an object created using the System.Xml.XmlTextWriter implementation.

When you use this overload, an System.Xml.XmlWriterSettings object with default settings is used to create the XML writer.

XmlWriterSettings.CheckCharacters

true

XmlWriterSettings.CloseOutput

false

XmlWriterSettings.ConformanceLevel

ConformanceLevel.Document

XmlWriterSettings.Encoding

System.Text.Encoding.UTF8

XmlWriterSettings.Indent

false

XmlWriterSettings.IndentChars

Two spaces

XmlWriterSettings.NamespaceHandling

NamespaceHandling.Default (no removal)

XmlWriterSettings.NewLineChars

\r\n (carriage return, new line)

XmlWriterSettings.NewLineHandling

NewLineHandling.Replace

XmlWriterSettings.NewLineOnAttributes

false

XmlWriterSettings.OmitXmlDeclaration

false

XmlWriterSettings.OutputMethod

XmlOutputMethod.Xml

XmlWriterSettings.WriteEndDocumentOnClose

true

If you want to specify the features to support on the created XML writer, use an overload that takes an System.Xml.XmlWriterSettings object as one of its arguments, and pass in a System.Xml.XmlWriterSettings object with your custom settings.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0