Determines what the application should do with white space found in the content
Three possible values:
preserve
: The white space in the input document is left unchanged
replace
: Each tab, carriage return and linefeed
is replaced with a single space.
collapse
: Each tab, carriage return and linefeed
is replaced with a single space. Furthermopre, after this replacement is
performed, all runs of multiple spaces are condensed to a single space.
leading and trailing white space is deleted.
No effect on validation
Applies to string
,
normalizedString
and token
type items
Per XML 1.0, white space in attributes is normalized irregardless of the schema
For example, to say that white space should be collapsed in all names and titles:
<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="SONG" type="songType"/> <xsd:simpleType name="NormalizedString"> <xsd:restriction base="xsd:string"> <xsd:whiteSpace value="collapse"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="songType"> <xsd:sequence> <xsd:element name="TITLE" type="NormalizedString"/> <xsd:element name="COMPOSER" type="NormalizedString" maxOccurs="unbounded"/> <xsd:element name="PRODUCER" type="NormalizedString" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="PUBLISHER" type="NormalizedString" minOccurs="0"/> <xsd:element name="LENGTH" type="xsd:timeDuration"/> <xsd:element name="YEAR" type="xsd:gYear"/> <xsd:element name="ARTIST" type="NormalizedString" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema>