XmlReaderSettings.IgnoreWhitespace Property

Definition

Gets or sets a value indicating whether to ignore insignificant white space.

public:
 property bool IgnoreWhitespace { bool get(); void set(bool value); };
public bool IgnoreWhitespace { get; set; }
member this.IgnoreWhitespace : bool with get, set
Public Property IgnoreWhitespace As Boolean

Property Value

true to ignore white space; otherwise false. The default is false.

Examples

The following creates a settings object that can be used to construct a reader that strips processing instructions, comments, and insignificant white space.

// Set the reader settings.
XmlReaderSettings^ settings = gcnew XmlReaderSettings;
settings->IgnoreComments = true;
settings->IgnoreProcessingInstructions = true;
settings->IgnoreWhitespace = true;
// Set the reader settings.
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreComments = true;
settings.IgnoreProcessingInstructions = true;
settings.IgnoreWhitespace = true;
' Set the reader settings.
Dim settings as XmlReaderSettings = new XmlReaderSettings()
settings.IgnoreComments = true
settings.IgnoreProcessingInstructions = true
settings.IgnoreWhitespace = true

Remarks

White space that is not considered to be significant includes spaces, tabs, and blank lines used to set apart the markup for greater readability. An example of this is white space in element content.

This property setting does not affect white space between markup in a mixed content mode, or white space that occurs within the scope of an xml:space='preserve' attribute.

Applies to

See also