users@jaxb.java.net

Re: Is there a way to support multiple schema versions in a single JAXB java set?...

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Thu, 20 Sep 2007 08:20:14 +0200

Hi.

> Hi, is there any way to generate JAXB java files from two versions of
> the same schema? For instance the webservices.xml schema version 1.1 is
> j2ee_web_services_1_1.xsd and version 1.2 is javaee_web_services_1_2.xsd.
> In 1.1 the ns is "http://java.sun.com/xml/ns/j2ee" and 1.2 ns is
> "http://java.sun.com/xml/ns/javaee".
>
> I would like the generated java and particularily the ObjectFactory to
> be able to handle unmarshalling webservices.xml documents of either
> schema version.
>
> Is there any way to do this? I tried just simply adding both schemas to
> the xjc command but that produces a bunch of collisions.

I did that for OpenGIS schemas which have really extended version
structure. I used to configure different output packages for different
schemas to avoid collisions.

Noe that your schemas may import/include other schemas which may also
produce collisions as well.

Compile the schemas separately and check where they intersect. Then
you may need to
* align the schema locations using catalog (if schemas import same
schemas but from different locations;
* customize output packages so that different versions of schemas
mapped onto the same target namespace are compiled in different
packages;
* divide schemas into several compilation blocks and use episodic
compilation to handle dependencies.

Bye.
/lexi