System.Xml.XmlTextReader.Normalization Property

Gets or sets a value indicating whether to normalize white space and attribute values.

Syntax

public bool Normalization { get; set; }

Value

A bool where true indicates to normalize; otherwise, false. The default is false.

Exceptions

TypeReason
InvalidOperationExceptionWhen attempting to set the property, the current instance has been closed.

Remarks

Note:

In the dnprdnext release, the recommended practice is to create System.Xml.XmlReader instances using the erload:System.Xml.XmlReader.Create method. This allows you to take full advantage of the new features introduced in this release. For more information, see Creating XML Readers.

This property can be changed at any time and takes effect on the next read operation.

Note:

If the System.Xml.XmlTextReader is used to construct an System.Xml.XmlValidatingReader, to normalize attribute values, Normalization must be set to true.

If Normalization is set to false, this also disables character range checking for numeric entities. As a result, character entities, such as �, are allowed.

The following describes attribute value normalization:

  • For a character reference, append the referenced character to the attribute value.

  • For an entity reference, recursively process the replacement text of the entity.

  • For a white space character (#x20, #xD, #xA, #x9), append #x20 to the normalized value. (Only a single #x20 is appended for a "#xD#xA" sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity.)

  • Process other characters by appending them to the normalized value.

  • If the declared value is not CDATA, discard any leading and trailing space (#x20) characters and replace sequences of space (#x20) characters with a single space (#x20) character.

The XmlTextReader only performs attribute or CDATA normalization. It does not do DTD-specific normalization unless wrapped within an XmlValidatingReader.

Refer to the W3C XML 1.0 recommendation for further discussion on normalization.

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