users@jaxb.java.net

Re: Date subtypes

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Tue, 28 Jun 2005 10:18:29 +1000

Hi Joe,

On 6/28/05, Joe Fialli <Joseph.Fialli_at_sun.com> wrote:
> Following is way to create an instance in Java that behaves as you desire:
>
> import javax.xml.datatype.DatatypeFactory;
> import javax.xml.datatype.XMLGregorianCalendar;
>
> DatatypeFactory df = DatatypeFactory.newInstance();
> // create xsd:date instance 1975-06-15
> XMLGregorianCalendar dob =.df.newXMLGregorianCalendarDate(1975, 6, 15,
> javax.xml.datatype.DatatypeConstants.FIELD_UNDEFINED).
>
> If unmarshalling an xml document into XMLGregorianCalendar field, the
> class' constructor remembers which fields where set or not.

Yep - that's what I was after - sorry I should have thought of that.
I've got another little java adaptor doing the job so I haven't had to
change my code.

> Documented in the public review for the specification but not
> implemented in RI yet, the above
> field could be annotated with @XmlSchemaType(name="date") to map
> java.lang.Date to xsd:date.

Ahhh, thanks. That's the solution I was thinking about but couldn't
find (probably a good thing I didn't find it or I would have really
been confused!).

cheers
dim