users@jaxb.java.net

Re: Binding file question

From: Lucas Jordan <lucasjordan_at_softhome.net>
Date: Tue, 24 Jan 2006 13:16:42 -0500

Thank you.
 I have found that adding:
<xsd:annotation>
        <xsd:appinfo>
            <jxb:globalBindings>
                <jxb:javaType name="java.util.Calendar"
xmlType="xsd:dateTime"
                parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
                printMethod="javax.xml.bind.DatatypeConverter.printDate" />
            </jxb:globalBindings>
        </xsd:appinfo>
    </xsd:annotation>

To my xsd document does change XMLGreCal to Calendar. I am not yet able to
create a binding file that does the same thing: here is my best guess, mind
you it does not even seem to be valid, so I guess it's not a good guess:

<bindings xmlns='http://java.sun.com/xml/ns/jaxb'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    xmlns:as='http://stuff'
    xsi:schemaLocation='http://java.sun.com/xml/ns/jaxb
http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd'
    version='2.0'>
    
    <globalBindings>
        <javaType name="java.util.Calendar" xmlType="xs:dateTime"
        parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
        printMethod="javax.xml.bind.DatatypeConverter.printDate" />
    </globalBindings>
   
</bindings>


What an I missing?
Thank you,
    Lucas

On 1/23/06 11:39 AM, "Kohsuke Kawaguchi" <kohsuke.kawaguchi_at_sun.com> wrote:

> William Simons wrote:
>> I would like to generate class files that use Calendar (or
>> GregorianCalendar) instead of XMLGregorianCalendar with jaxb 2.0.
>>
>> I have tried many configurations and to no avail.
>>
>> Can some one show me an example external binding file that does this
>> globally.
>
> Attached the modified version of the datatypeconverter sample that shows
> how to do it.
>
> See <javaType> inside <globalBindings>. That's the key.