users@jaxb.java.net

Re: Binding file question

From: Ed Mooney <Ed.Mooney_at_Sun.COM>
Date: Thu, 26 Jan 2006 13:05:03 -0500

Hi Lucas,

Your external binding file needs to specify the location in your schema
for applying the customizations, using XPath. In the case of
globalBindings, this is usually something like:

   <jxb:bindings schemaLocation="your_schema.xsd" node="/xs:schema">
     <jxb:globalBindings ...> ... </> ... </>

@node specifies the location. Please see the external-customize sample.

   -- Ed

Lucas Jordan wrote:
> 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
>
[ ... ]