∟"normalizedString" Datatype Values and Representations
This section describes the first derived datatype of 'string': 'normalizedString'. Whitespace characters are replaced in 'normalizedString' lexical representations with ' ' characters to obtain their values.
Based on what we have learned on "string" datatype in the previous section,
let's now look at its first derived datatype: normalizedString.
"normalizedString" is a datatype derived from "string" datatype
by normalizing whitespace characters to space characters.
"normalizedString" value set is smaller than "string" value set.
It contains only unique "string" values after whitespace characters: '\t', '\r' and '\n',
are normalized (replaced) by the space character: ' '.
Note that '\t', '\r' and '\n' are still allowed in "normalizedString" lexical representations.
But they are replaced by ' ' to obtain "normalizedString" values.
For example, 3 XML elements below are all valid and represent the same "normalizedString" value:
Here is a sample XML document that contains <NormalizedString> elements conforming with that definition:
<?xml version="1.1"?>
<!-- normalizedString_datatype_test.xml
- Copyright (c) 2013, HerongYang.com, All Rights Reserved.
-->
<NormalizedString_Datatype_Test>
<!-- 3 valid "normalizedString" elements represent the same value
Assuming \r\n is the line break -->
<NormalizedString>Herong Yang</NormalizedString>
<NormalizedString>Herong
Yang</NormalizedString>
<NormalizedString>Herong
Yang</NormalizedString>
<!-- 3 valid "normalizedString" elements represent different
values -->
<NormalizedString>Herong Yang</NormalizedString>
<NormalizedString>Herong Yang</NormalizedString>
<NormalizedString> Herong Yang</NormalizedString>
</NormalizedString_Datatype_Test>
You can modify this example to try other "normalizedString" lexical representations and values.