This section describes the built-in primitive datatype, 'boolean' that represents 2 Boolean values of true and false. Whitespaces are allowed and removed.
"boolean" is probably the most simplest built-in datatype supported in XSD 1.1.
Here is how it is defined:
The value space of "boolean" contains 2 values: true and false.
The lexical space of "boolean" contains 4 representtions: 'true', 'false', '1' and '0'.
Leading and trailing whitespaces allowed and trimmed.
To verify these rules, I wrote this simple XSD document that uses "boolean" datatype to declare XML elements:
When validating this XML document with my XsdSchemaValidator.java program presented earlier in the book,
I get 6 groups of errors for 6 invalid XML elements:
c:\Progra~1\Java\jdk1.7.0_07\bin\java XsdSchemaValidator
boolean_datatype_test.xsd boolean_datatype_test.xml
Error:
Line number: 14
Column number: 33
Message: cvc-datatype-valid.1.2.1: 'True' is not a valid value for
'boolean'. (Must all lower cases)
Error:
Line number: 14
Column number: 33
Message: cvc-type.3.1.3: The value ' True ' of element
'Boolean' is not valid.
Error:
Line number: 15
Column number: 34
Message: cvc-datatype-valid.1.2.1: 'FALSE' is not a valid value for
'boolean'. (Must all lower cases)
Error:
Line number: 15
Column number: 34
Message: cvc-type.3.1.3: The value ' FALSE ' of element
'Boolean' is not valid.
Error:
Line number: 16
Column number: 31
Message: cvc-datatype-valid.1.2.1: '1=1' is not a valid value for
'boolean'. (Not a valid representation)
Error:
Line number: 16
Column number: 31
Message: cvc-type.3.1.3: The value ' 1=1 ' of element 'Boolean'
is not valid.
Failed with errors: 6