I use JAXB for un / marshaling the XML messages that I receive from the server. I usually get XMLGregorianCalendar values in fields that are divided as xs: dateTime in the description of the XSD files, so the conversion to XMLGregorianCalendar is done automatically by JAXB.
Example from XSD file
<xs:attribute name="readouttime" use="required" type="xs:dateTime" />
However, one field is defined as xs: string like this:
<xs:element minOccurs="1" maxOccurs="1" name="Value" type="xs:string" />
but I get a value that should represent dateTime:
<Value>2014-08-31T15:00:00Z</Value>
Is there any good way how to convert this string to XMLGregorianCallendar, or should I use SimpleDateFormat and type the template manually? I feel this can be a dangerous part.
source
share