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. Furthermore, 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="CollapsedString"> <xsd:restriction base="xsd:string"> <xsd:whiteSpace value="collapse"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="songType"> <xsd:sequence> <xsd:element name="TITLE" type="CollapsedString"/> <xsd:element name="COMPOSER" type="CollapsedString" maxOccurs="unbounded"/> <xsd:element name="PRODUCER" type="CollapsedString" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="PUBLISHER" type="CollapsedString" minOccurs="0"/> <xsd:element name="LENGTH" type="xsd:duration"/> <xsd:element name="YEAR" type="xsd:gYear"/> <xsd:element name="ARTIST" type="CollapsedString" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema>