users@jaxb.java.net

Re: Help needed: multiples schemas

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 17 Apr 2006 16:51:34 -0700

Jorge M. wrote:
> a) Does anybody has pros/cons regarding the use of multiple schemas
> vs using a single schema with multiple roots allowed? I decided to use
> multiple schemas to keep them maintainable. (I don't have control over
> some of the schemas and they use the same element names but with
> different set of attributes and subelements. Creating a single schema
> may become difficult to maintain).

It's a good idea to modularize, but you don't want people to constantly
grepping which schema file they should be looking into. It's very
difficult to say.

It's like asking "should I be using two classes for this or one". It's
impossible to say anything to a question like without a lot of details,
and even with details you still get different answers depending on who
you ask.

> b) I am calling xjc.bat 5 different times, therefore I get 5
> different ObjectFactory classes, each under a different java package.
> Is there a way to keep my 5 different schemas but get only a single
> ObjectFactory ?

Yes. Just run xjc once with all the schemas specified in the command
line. e.g.,

   $ xjc *.xsd


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com