users@jaxb.java.net

Re: Edit Schema type on input parameter

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 29 Nov 2011 18:43:15 +0100

Going from the XML schema entry

   <xs:element name="Day" type="xs:date"/>

and by calling xjc you get Java code with annotations

    @XmlElement(name = "Day", required = true)
    @XmlSchemaType(name = "date")
    protected XMLGregorianCalendar day;

and the usual getter and setter. I'd expect that a schemagen from this
should give you what you want, but I haven't tried it.

HTH
-W


On 29 November 2011 17:21, <jeremychocolate_at_gmail.com> wrote:
> I am working on a web service using CXF/JAXB. I am trying to modify the
> generated XML schema for a date parameter.
>
> Given the following method signature:
> public void Something(Date theDate);
>
> How can I modify theDate such that it’s schema is xs:date rather than
> xs:dateTime?
>
> What I would like to do:
> public void Something(@XmlSchemaType(name=”date”)Date theDate);
>
> I have endorsed jaxb-api v2.2.1, which has allowed me to add the
> XmlElement annotation, on theDate, but I really need the XmlSchemaType
> annotation (or is there a way to use the type attribute of XmlElement?)
>
>
> Thanks,
> Jeremy Robertson