Reputation: 97
We are unmarshalling date field using JAXB. The format that is coming in the xml is like
2013-10-07 03:57:36.703
In my DTO class, the field where this value has to be populates looks like
@XmlElement(name = "VALID_TO", required = true)
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar validto;
But, after unmarshalling, I don't get anything in valito.
In the xsd, VALID_TO
has a custom xsd:date
mapping with pattern[0-9]{4}-[0-9]{2}-[0-9]{2}
Is it necessary to have timeZone in the value to be able to convert to XmlGregorianCalendar ?
Thanks !!!
Upvotes: 1
Views: 1487
Reputation: 148977
The following formats will work with JAXB
and XMLGregorianCalendar
out of the box.
2013-10-07
2013-10-07T03:57:36.703
If you want an alternate format such as 2013-10-07 03:57:36.703
you can use an XmlAdapter
.
Upvotes: 0