users@jaxb.java.net

Re: jaxb globalbinding and import

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 05 Jun 2007 16:44:58 -0700

bennop wrote:
> I have the following problem: Please see the following snippet:
>
> <xs:import namespace="http://www.atoss.com/AMF" schemaLocation="AMF.xsd"/>
> <xs:annotation>
> <xs:appinfo>
> <jaxb:schemaBindings>
> <jaxb:package name="amf.jaxb.pmodel"/>
>
> </jaxb:schemaBindings>
> <jaxb:globalBindings generateIsSetMethod="true">
> <xjc:superClass name="com.atoss.ses.amf.pmodel.base.PModelBase"/>
> </jaxb:globalBindings>
> </xs:appinfo>
>
> In this schema I want all elements of the scheme to have a base class of
> com.atoss.ses.amf.pmodel.base.PModelBase. This works correctly. I also
> have a import of another schema (AMF.xsd).The problem is that all elements
> in my imported schema also have the base class PModelBase.

That is what "global" in globalBindings mean.

> I don't want my
> imported schema elements to have this base class. Any suggestions??

If we had <superClass> under <jaxb:schemaBindings>, that would have been
ideal for you, but we don't have that.

So you have to rely on the last resort, which is to write a plugin.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com