users@jaxb.java.net

Re: Working with multiple vendor files - How To

From: Franklin, Brian <brian.franklin_at_ciraden.com>
Date: Fri, 27 Jun 2003 15:06:12 -0400

You are correct about the differences.

Typically, as you may know, the targetNamespace in a given schema is used to
determine the package for the classes generated from that schema. When
giving my one-liner piece of advice, I made the assumption that the schemas
you were importing had their own unique namespaces, and thus would be bound
into different packages. But if they have no targetNamespace, then
obviously this wouldn't work. Also, if you specify -p [package name] when
invoking XJC, I believe this overrides the normal functionality and will
place all generated classes into the single specified package no matter what
the targetNamespaces are.

So, now for the practice advice part... No matter what the case, one way to
help be sure about the behavior is to use the<package> customization under
<schemaBindings> (see the JAXB spec section 6.6.1.1) to specify the package
for each schema, and don't use -p on the XJC command line.

Sorry I wasn't more verbose/thorough to begin with...Cutting corners and all
that. Let me know if that helps,

Brian

-----Original Message-----
From: Pratt, Jerald [mailto:jerald.pratt_at_ngc.com]
Sent: Friday, June 27, 2003 2:19 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Working with multiple vendor files - How To


Brian,

I have use both <import> and <include> w/in my schemas and compiling these
with xjc will always create one large package as opposed to varioius
separate packages that can call on one another. Also, the differences
between <import> and <include> don't really make them interchangible. I
could be wrong, but I believe you use <import> when referencing a separate
namespace where as you use <include> when you are simply adding to your
current namespace (but maybe my view of this is too simplistic).

Jerald


-----Original Message-----
From: Franklin, Brian [mailto:brian.franklin_at_ciraden.com]
Sent: Friday, June 27, 2003 11:19 AM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Working with multiple vendor files - How To


I think you may want to use <import> rather than <include>.

Brian Franklin

-----Original Message-----
From: Hank Ratzesberger [mailto:hankr_at_crustal.ucsb.edu]
Sent: Friday, June 27, 2003 11:54 AM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Working with multiple vendor files - How To


Koshuke,

Let me try again, thank you.

I have several complex schemas from other vendors
(mostly ISO and OpenGIS) which I would like to
place in their own packages.

These files <include> each other, so when I
generate the classes, I get one big package.
(They are distributed this way, and I simply
used them.)

Perhaps what I need to do is remove the <include>
and use the catalog to instruct xjc where the
schemas are to resolve dependencies at runtime.

Basically, I don't want to end up with one
huge package.

--Hank

----- Original Message -----
From: "Kohsuke Kawaguchi" <Kohsuke.Kawaguchi_at_Sun.COM>
To: <JAXB-INTEREST_at_JAVA.SUN.COM>
Sent: Friday, June 27, 2003 8:24 AM
Subject: Re: Working with multiple vendor files - How To


> I'm sorry, but I don't understand your question.
>
> Hank Ratzesberger <hankr_at_crustal.ucsb.edu> wrote:
> > I am sure what the best method is to working
> > with multiple schemas. I experimented with a
> > binding solution that separated the classes
> > into packages based on the namespace URI
> > automatically. This allowed me to directly
> > include xsd files (indeed it was required in
> > order to resolve all entities to primitives).
> >
> > With JAXB, only one is created for each
> > compilation.
> >
> > Do I remove the <import> statements and
> > rely on the cataloging feature, then make
> > a separate build for each schema?
> >
> > Thanks in advance for any tips on a
> > method/methodology of working with JAXB
> > and third party published schemas.
> >
> > Regards,
> >
> > ============================================
> > Replying to a list? I'll get my copy there!
> >
> > Hank Ratzesberger
> > http://crustal.ucsb.edu/ | http://neesgrid.org/
> > Institute for Crustal Studies
> > University of California, Santa Barbara
> > ============================================
>
>
> regards,
> --
> Kohsuke Kawaguchi 408-276-7063 (x17063)
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>