users@jaxb.java.net

Date subtypes

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Mon, 27 Jun 2005 14:23:12 +1000

Hi,

I've got a type of the following:

        <xsd:simpleType name="BirthDate">
                <xsd:restriction base="xsd:date">
                        <xsd:minInclusive value="1890-01-01"/>
                        <xsd:maxInclusive value="2049-12-31"/>
                        <xsd:pattern value="\d\d\d\d-\d\d-\d\d"/>
                </xsd:restriction>
        </xsd:simpleType>

and then I have a snippet of code that is:

        @XmlElement(name = "BirthDate")
        public Date getDob()
        {
                return dob;
        }

        public void setDob(Date dob)
        {
                this.dob = dob;
        }

However this spits out

    <BirthDate>1975-06-15T00:00:00+10:00</BirthDate>

which obviously isn't valid. I've been going well migrating across a
bunch of existing code but am a bit stumped on this one. Is there a
common solution to this?

cheers
dim