users@jaxb.java.net

Re: Generating to different packages throgh inclusion

From: Pratt, Jerald <jerpratt_at_northropgrumman.com>
Date: Thu, 13 Mar 2003 09:36:56 -0800

Sekhar,

That is not what I'm seeing though (or maybe I just don't understand the
fine details). I am not using the <schemaBindings> in my XSD files. I have
all of my schema files in a single directory and there is a root schema file
that the other schema files are referenced from directory or somewhere down
the parentage. And each schema file does define its own namespace with a
statement such as:

 targetNamespace="http://www.northgrum.com/Tracks/TracksList"

When I run the xjc command on this schema file (root file in the hierarchy),
I get a single Java package that provides access to all child elements that
are defined in this same file or in other child schema files (each having
its own namespace definition similar to the statement shown above except for
the last field is unique for that given file).

When I started, I was assuming that the elements defined in each file
(having its own unique namespace) would be provided in a separate package.
But as it turned out, I was able to access all the classes from the package
defined for the root schema file.

What am I missing here?

Jerald



-----Original Message-----
From: Sekhar Vajjhala [mailto:sekhar.vajjhala_at_SUN.COM]
Sent: Thursday, March 13, 2003 4:27 AM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Generating to different packages throgh inclusion


>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.

A target namespace is mapped to a package. So if there are 5 multiple
schema files, each defining its own namespace, then this would be
mapped to 5 different packages. This is true even when a target namespace
is being imported.

There can be one <schemaBindings> customization per target namespace.
So in the above example, each schema file can contain a single
<schemaBindings> declaration that applies to the target namespace
defined in that file.

Sekhar Vajjhala - Sun Microsystems