This section describes constraining facets on union datatypes. New simple datatype can be defined with a 'restriction' construction component using a union datatype as the base.
From the previous tutorial, we know that there are 2 categories of union datatypes:
Atomic Union Datatype - A datatype where the entire lexical representation is mapped to a single value in the value space.
And all of its member datatypes are atomic datatypes or atomic union datatypes.
List Union Datatype - A datatype where the entire lexical representation is mapped to a single value or a list of values
in the value space.
And one or more of its member datatypes are list datatypes or list union datatypes.
Both atomic union datatypes and list union datatypes support the following constraining facets:
When validating this XML document with my XsdSchemaValidator.java program presented earlier in the book,
I get these errors:
c:\Progra~1\Java\jdk1.7.0_07\bin\java XsdSchemaValidator
union_facet_test.xsd union_facet_test.xml
Error:
Line number: 12
Column number: 38
Message: cvc-pattern-valid: Value '1000' is not facet-valid with
respect to pattern '-?\d\d\d|\d' for type
'#AnonType_AtomicUnionUnion_Facet_Test'.
Error:
Line number: 12
Column number: 38
Message: cvc-type.3.1.3: The value '1000' of element 'AtomicUnion'
is not valid.
Error:
Line number: 13
Column number: 35
Message: cvc-datatype-valid.1.2.3: '0' is not a valid value of
union type '#AnonType_AtomicUnionUnion_Facet_Test'.
Error:
Line number: 13
Column number: 35
Message: cvc-type.3.1.3: The value '0' of element 'AtomicUnion' is
not valid.
Error:
Line number: 20
Column number: 35
Message: cvc-pattern-valid: Value '-2013' is not facet-valid with
respect to pattern '\d\d\d\d|\d\d \d\d' for type
'#AnonType_ListUnionUnion_Facet_Test'.
Error:
Line number: 20
Column number: 35
Message: cvc-type.3.1.3: The value '-2013' of element 'ListUnion'
is not valid.
Error:
Line number: 21
Column number: 38
Message: cvc-pattern-valid: Value '11 22 33' is not facet-valid
with respect to pattern '\d\d\d\d|\d\d \d\d' for type
'#AnonType_ListUnionUnion_Facet_Test'.
Error:
Line number: 21
Column number: 38
Message: cvc-type.3.1.3: The value '11 22 33' of element
'ListUnion' is not valid.
Failed with errors: 8