System.Xml.XmlDocument.PreserveWhitespace Property

Gets or sets a value indicating whether to preserve white space in element content.

Syntax

public bool PreserveWhitespace { get; set; }

Value

A boolean value that indicates whether this document preserves whitespacenodes when it loads the document content.

Remarks

This property determines how white space is handled during the load and save process.

If PreserveWhitespace is true before XmlDocument.Load(string) or XmlDocument.LoadXml(string) is called, white space nodes are preserved; otherwise, if this property is false, significant white space is preserved, white space is not.

If PreserveWhitespace is true before XmlDocument.Save(string) is called, white space in the document is preserved in the output; otherwise, if this property is false, XmlDocument auto-indents the output.

This method is a Microsoft extension to the Document Object Model (DOM).

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0