xs:union — Derivation of simple datatypes by union.
<xs:union id = xs:ID memberTypes = list of xs:QName {any attributes with non-schema namespace} > Content: ((xs:annotation?), (xs:simpleType*)) </xs:union>
May be included in: xs:simpleType (local definition), xs:simpleType (global definition)
Deriving a simple datatype by union merges the lexical spaces of several simple datatypes (called member types) to create a new simple datatype.
Whatever the type (atomic, list, or union) of the member types, the
resulting datatype has a type union
.
The member types can be defined either by reference (through the
memberTypes
attribute) or embedded as simple
datatype local definitions in the xs:union
element. Both styles can be mixed.
The semantic of the member datatypes is lost at least as far as
validation is concerned, and the only facets that can be further
applied to the resulting datatype are xs:pattern
and xs:enumeration
.
However, the semantic of the member datatypes isn’t
completely lost for an application built on a PSVI, since the
validator needs to perform canonicalization according to the first
member type that matches the instance value. This implies that order
matters in the list of member types. When both styles are used, the
datatypes referenced in the memberTypes
are tested
before the locally defined datatypes.