XmlWriterSettings Class
Specifies a set of features to support on the XmlWriter object created by the XmlWriter::Create method.
Assembly: System.Xml (in System.Xml.dll)
The XmlWriterSettings type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | CheckCharacters | Gets or sets a value indicating whether to do character checking. |
![]() ![]() ![]() | CloseOutput | Gets or sets a value indicating whether the XmlWriter should also close the underlying stream or TextWriter when the Close method is called. |
![]() ![]() ![]() | ConformanceLevel | Gets or sets the level of conformance which the XmlWriter complies with. |
![]() ![]() ![]() | Encoding | Gets or sets the type of text encoding to use. |
![]() ![]() ![]() | Indent | Gets or sets a value indicating whether to indent elements. |
![]() ![]() ![]() | IndentChars | Gets or sets the character string to use when indenting. This setting is used when the Indent property is set to true. |
![]() | NamespaceHandling | Gets or sets a value that indicates whether the XmlWriter should remove duplicate namespace declarations when writing XML content. The default behavior is for the writer to output all namespace declarations that are present in the writer's namespace resolver. |
![]() ![]() ![]() | NewLineChars | Gets or sets the character string to use for line breaks. |
![]() ![]() ![]() | NewLineHandling | Gets or sets a value indicating whether to normalize line breaks in the output. |
![]() ![]() ![]() | NewLineOnAttributes | Gets or sets a value indicating whether to write attributes on a new line. |
![]() ![]() ![]() | OmitXmlDeclaration | Gets or sets a value indicating whether to write an XML declaration. |
![]() ![]() | OutputMethod | Gets the method used to serialize the XmlWriter output. |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | Clone | Creates a copy of the XmlWriterSettings instance. |
![]() ![]() ![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() ![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() ![]() | Reset | Resets the members of the settings class to their default values. |
![]() ![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The Create method is the preferred mechanism for obtaining XmlWriter instances. The Create method uses the XmlWriterSettings class to specify which features to implement in the created XmlWriter object.
Note |
|---|
If the XmlWriter is being used with the Transform method, you should use the OutputSettings property to obtain an XmlWriterSettings object with the correct settings. This ensures that the created XmlWriter object has the correct output settings. |
For more information, see Creating XML Writers.
The following example creates an XmlWriter that writes to an XML file and writes each attribute on a new line.
The sample produces the following output:
<order orderID="367A54" date="2001-05-03"> <price>19.95</price> </order>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

