Name

xs:whiteSpace — Facet to define whitespace behavior.

Synopsis

<xs:whiteSpace
           fixed          = xs:boolean : “false”
           id             = xs:ID
           value          = ( “preserve” | “replace” | “collapse” )
           {any attributes with non-schema namespace}
           >
           Content: (xs:annotation?)
</xs:whiteSpace>

May be included in: xs:restriction (simple type), xs:restriction (simple content)

May be used as facet for:xs:ENTITIES, xs:ENTITY, xs:ID, xs:IDREF, xs:IDREFS, xs:language, xs:Name, xs:NCName, xs:NMTOKEN, xs:NMTOKENS, xs:normalizedString, xs:string, xs:token

Description

This facet defines the treatment to perform on whitespace—i.e., #x20 (space), #x9 (tab), #xA (linefeed), and #xD (carriage return)—during the transformation between the lexical and value spaces.

Its values are preserve (whitespace characters are kept unchanged), replace (all instances of whitespace are replaced with a space), and collapse (leading and trailing whitespace is removed and all the other sequences of contiguous whitespace are replaced by a single space).

Restrictions

This is the only facet (or feature of W3C XML Schema) that interacts with the canonicalization transformation.

It is not possible to “relax” the whitespace behavior during a restriction: if a datatype has a whitespace set as preserve, its derived datatypes can have any whitespace behavior, but if its whitespace is set as replace, its derived datatypes can only have whitespace equal to replace or collapse. If its whitespace is equal to collapse, all its derived datatypes must have the same behavior.

This limitation is somewhat paradoxical since it allows the actual expansion of the lexical space of a datatype during a derivation by restriction.

Example

<xs:simpleType name="CapitalizedNameWS">
  <xs:restriction base="xs:string">
    <xs:whiteSpace value="collapse"/>
    <xs:pattern value="([A-Z]([a-z]*) ?)+"/>
  </xs:restriction>
</xs:simpleType>

Attributes

fixed

When set to fixed, the value of this facet cannot be changed in further restrictions.

id

W3C XML Schema’s element ID.

value

Value of the facet .

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.147.190