users@jaxb.java.net

Re: Generating to different packages throgh inclusion

From: Pratt, Jerald <jerpratt_at_northropgrumman.com>
Date: Thu, 13 Mar 2003 00:21:31 -0800

What about when you have separate namespaces defined for each schema file?
I have about 5 different schema files and each defines its own namespace.
Some of the schema files will use the "import" to bring in one or more of
the other schema files/namespaces. But could this configuration work for
breaking up the JAXB generated classes into multiple packages? I know that
when I ran the code generator all the code when into a single package but I
didn't so anything special to try to break them up into different packages.


Before trying JAXB, I played around with XMLBeans from BEA. Their code
generation automatically breaks up each namespace into a separate Java
package which required me to use multiple import statements but when using
JAXB with the same XML Schema files, all the code was generated into a
single package.

Jerald Pratt


-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Wednesday, March 12, 2003 12:43 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Generating to different packages throgh inclusion


Everything with the same target namespace will go into the same Java
package. And there's no exception to it.

It doesn't matter whether you use two xsd files or one file.

So the short answer of the status quo is that there's no way you can
achieve what you want. I think it can be considered as a bug of RI for
failing to raise an error for those two conflicting customizations.

That said, I think I'm seeing this request (ability to sub-divide one
namespace into multiple Java packages) fairly frequently, and I think
it's well founded. Some schemas are really big, and naturally one would
want to split them into sub-packages.

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com