∟"dateTimeStamp" Datatype Values and Representations
This section describes the built-in primitive datatype, 'dateTimeStamp' that represents moments of time in Gregorian calendar. Leading and trailing whitespaces are allowed and trimmed. Timezone offset is required.
"dateTimeStamp" is a built-in datatype derived from "dateTime" datatype introduced in XSD 1.1
to represent a moment of time in the Gregorian calendar system
with these rules:
The value space of "dateTimeStamp" is all possible moments in time in Gregorian calendar with
"year" in the range of -2147483648 and 2147483647.
The lexical space of "dateTimeStamp" is all possible "dateTimeStamp" values represented in
(year)-(month)-(date)T(hour):(minute):(second)(timezoneOffset) patten.
"year", "month", "date", "hour", "minute", "second" and "timezoneOffset" are all required properties.
Leading and trailing whitespaces allowed and trimmed.
To verify these rules, I wrote this simple XSD document that uses "dateTimeStamp" datatype to declare XML elements:
Since "dateTimeStamp" is introduced in XSD 1.1,
I need to use my Xsd11SchemaValidator.java program presented earlier in the book
to run the test:
c:\Progra~1\Java\jdk1.7.0_07\bin\java
-cp ".;c:\local\xerces-2_11_0-xml-schema-1.1-beta\xercesImpl.jar;
c:\local\xerces-2_11_0-xml-schema-1.1-beta
\org.eclipse.wst.xml.xpath2.processor_1.1.0.jar"
Xsd11SchemaValidator
dateTimeStamp_datatype_test.xsd dateTimeStamp_datatype_test.xml
Error:
Line number: 14
Column number: 61
Message: cvc-datatype-valid.1.2.1: '1971-05-16T00:00:01' is not a
valid value for 'dateTimeStamp'. (Missing "timezoneOffset")
Error:
Line number: 14
Column number: 61
Message: cvc-type.3.1.3: The value ' 1971-05-16T00:00:01 '
of element 'DateTimeStamp' is not valid.
Error:
Line number: 15
Column number: 54
Message: cvc-datatype-valid.1.2.1: '1971-05-16-05:00' is not a
valid value for 'dateTimeStamp'. (Missing "time" value)
Error:
Line number: 15
Column number: 54
Message: cvc-type.3.1.3: The value ' 1971-05-16-05:00' of
element 'DateTimeStamp' is not valid.
Error:
Line number: 16
Column number: 55
Message: cvc-datatype-valid.1.2.1: '00:00:01+00:00' is not a valid
value for 'dateTimeStamp'. (Missing "date" value)
Error:
Line number: 16
Column number: 55
Message: cvc-type.3.1.3: The value ' 00:00:01+00:00 ' of
element 'DateTimeStamp' is not valid.
Failed with errors: 6