users@jaxb.java.net

Re: how to refer to a common schema without duplicating entries found in the common namespace

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 07 Feb 2005 12:19:24 -0800

Jean-Marie Condom wrote:
> i have a common schema called common.xsd whose defined types
> are refered (and not redefined) in other schemas such as for instance A
> and B ;
>
> my purpose is to generate only one set of classes (those from common.xsd)
>
> the pb is that if A and B refer to common.xsd, compiling A and B will
> generate
> classes refered in A and B and defined in common.xsd ; i tried with
> <xsd:include
> i get the same duplication
>
> for instance common.xsd contains the following type :
> <!-- parity-->
> <xsd:simpleType name="parityType">
> <xsd:annotation>
> <xsd:appinfo>
> <jaxb:typesafeEnumClass name="parityType">
> <jaxb:typesafeEnumMember name="NONE" value="NONE"/>
> <jaxb:typesafeEnumMember name="EVEN" value="EVEN"/>
> <jaxb:typesafeEnumMember name="ODD" value="ODD"/>
> <jaxb:typesafeEnumMember name="MARK" value="MARK"/>
> <jaxb:typesafeEnumMember name="SPACE" value="SPACE"/>
> </jaxb:typesafeEnumClass>
> </xsd:appinfo>
> </xsd:annotation>
> <xsd:restriction base="xsd:string">
> <xsd:enumeration value="NONE"/>
> <xsd:enumeration value="EVEN"/>
> <xsd:enumeration value="ODD"/>
> <xsd:enumeration value="MARK"/>
> <xsd:enumeration value="SPACE"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> in A and B i may refer to parityType defining an attribute such as :
>
> <xsd:attribute name="parity" type="parityType" use="required"/>
>
> whether i use <xsd:import or <xsd:include, if i compile A and B
> parityType.class is generated twice
>
> is there a way to generate classes from that common schema only once ?

Sorry, I'm still bit confused.

Are you compiling schema A and B at the same time? If not, that's the
reason you get two copies, and it sounds very similar to the issue Jerry
raised in the past few days.

Is there any reason in your case as to why you can't compile them all at
once?


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com