xs:whiteSpace

Purpose

This element is used for handling whitespace normalization of xs:string data types. The xs:whiteSpace element may be specified additionally to other facets.

The corresponding feature of the W3C XML Schema is described in http://www.w3.org/TR/xmlschema-2/#dt-whiteSpace.

Parent element xs:restriction
Child elements xs:annotation
Attributes fixed, id, value
Attributes
Name Type Description
fixed xs:boolean If "true", the value of this facet must not be changed in a derived type. Default: "false".
id xs:ID Assigns an identifier to the schema node.
value xs:string

This attribute allows you to control whitespace normalization. It has one of three predefined values:

  • "preserve"
    No normalization takes place, the value remains unchanged.

  • "replace"
    Each occurrence of the ASCII characters #x9 (tab), #xA (line feed) and #xD (carriage return) is substituted by #x20 (space).

  • "collapse"
    This means the same processing as replace, but additionally each sequence of one or more consecutive #x20 (space) characters is converted to a single #x20 character; furthermore, leading and trailing #x20 characters are removed.

For all data types other than xs:string, the value is fixed to "collapse".

Example

This simple example shows the use of the xs:whiteSpace element: