Attribute Value Normalization

XmlTextReader.Normalization is a property available in the XmlTextReader that allows applications to define whether to do white space normalization and attribute normalization. This property, set on a non-validating parser, is defined in the Extensible Markup Language (XML) 1.0 Recommendation, section Attribute-Value Normalization, located at www.w3.org/TR/2000/REC-xml-20001006.html\#AVNormalize. The default setting for the Normalization property is false. When false, the XmlTextReader allows character entities like � because this flag also turns off character range checking for numeric entities.

The WC3 recommendation specifies that before the value of an attribute is passed to an application or checked for validity, it must be normalized as follows:

  • 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 characters (#x20, #xD, #xA, #x9), append #x20 to the normalized value, with the exception that 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, then discard any leading and trailing space (#x20) characters, and replace sequences of space (#x20) characters by a single space (#x20) character.

See Also

Reading XML with the XmlReader | Full Content Reads using Character Streams | Document Type Declaration Information | Handling White Space with XmlTextReader | Exception Handling using XmlException in XmlTextReader | XmlReader Class | XmlReader Members | XmlNodeReader Class | XmlNodeReader Members | XmlTextReader Class | XmlTextReader Members | XmlValidatingReader Class | XmlValidatingReader