dev@jaxb.java.net

xs:date and java.util.Date

From: Mark Emeny <Mark.Emeny_at_focus-solutions.co.uk>
Date: Wed, 15 Nov 2006 10:48:25 -0000

Hi,


 

I have the following:

 

       @XmlElement(name = "DateOfBirth")

       @XmlSchemaType(name = "date")

       private Date dateOfBirth;

 

and the XSD that follows running schemagen looks fine. However, when I
marshal a java.util.Date into an XML document I am left with a
xs:dateTime which of course violates the schema validation.

 

Is there something I need to do to force the java.util.Date to be
marshalled correctly when an xs:date schema type has been applied?

 

Many thanks,

 

Mark Emeny.