Affects Version/s: current
Fix Version/s: None
Operating System: Windows XP
The following problem could be observed in Jaxb 2.1:
Having an XML schema that defines the following type:
<element name="PublishedStartTime" type="dateTime" minOccurs="0"/>
and an having an XML instance document with the following entry:
... i.e. with trailing and leading whitespaces, will result in an an
unmarshalled PublishedStartTime of null instead of the expected date and time.
The problem does not occur, if the entry in the XML instance document looks as
... i.e. there are no leading and trailing whitespaces.
The Jaxb-classes generated with XJC use XMLGregorianCalendar as the data type
holding dateTime types.
The problem seems to be that the XMLGregorianCalendar / DatatypeFactory does not
support input strings with leading and trailing whitespaces as documented in
Additionally it seems that the Jaxb2.1 runtime does not remove leading and
trailing whitespaces from dateTime entries.
We believe this is a bug, since either XMLGregorianCalendar should support
leading and trailing whitespaces, or Jaxb2.1 RI should remove leading and
trailing whitepsaces for dateTime entries. Otherwise, another JavaType than
XMLGregorianCalendar should be used as default type for xsd:dateTime types.
Hao and Florian