when unmarshalling from xml, can we map the date object or calendar object?
Asked
Active
Viewed 586 times
3 Answers
2
I assume you're talking about JAXB here? If so then yes. Just use the javaType binding declaration in your JAXB bindings. See here: http://download.oracle.com/javaee/5/tutorial/doc/bnbbf.html

Simeon G
- 1,188
- 8
- 20
-
1Also see this other stackoverflow question and its solution: http://stackoverflow.com/questions/3679266/simple-conversion-between-java-util-date-and-xmlgregoriancalendar – Simeon G Mar 10 '11 at 02:09
1
Yes. According to the mapping table on this page, xsd:date maps to XMLGregorianCalendar.

Bala R
- 107,317
- 23
- 199
- 210
1
You can map to Calendar, Date, or XMLGregorianCalendar:
You can leverage the @XmlSchemaType annotation to choose the XML format: xsd:date, xsd:dateTime, xsd:time, etc.

bdoughan
- 147,609
- 23
- 300
- 400