users@jaxb.java.net

Re: Class generation and <xsd:include>

From: Franklin, Brian <brian.franklin_at_ciraden.com>
Date: Tue, 21 Jan 2003 16:41:26 -0500

Brett,

To add to Kohsuke's response, I believe what you might be looking for is the
<xsd:import> tag. This works like a Java import. It is used in the case
where the included schema belongs to a different namespace than the
including schema.

If, for example, your common_schemas.xsd has a targetNamespace of
"com.foo.util", then when you compile A.xsd, you will get files in
com.foo.util and com.foo.a. Then, when you compile B.xsd, you will get
files in com.foo.util (btw, they will overwrite the ones generated in the
previous compile) and com.foo.b.

Brian

-----Original Message-----
From: Brett Ramdeen [mailto:bramdeen_at_CERTAPAY.COM]
Sent: Tuesday, January 21, 2003 4:18 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Class generation and <xsd:include>


I have a collection of schemas which are dependent on a parent schema that
defines basic types which are common to all of the child schemas. The child
schemas all refer to the parent schema by use of an <xsd:include> tag.

When generating the java classes for the child schemas, I specifiy a
different package for each child. Ie: Two schemas called A.xsd and B.xsd
would for example have their JAXB interfaces and classes created in the
package com.foo.a and com.foo.b.

My concern is that since A.xsd and B.xsd include common_types.xsd (for sake
of the example). The interfaces and implementation classes found in
common_types.xsd are created in both com.foo.a AND com.foo.b. These classes
do not need to be created twice.

Is there a way to specify a package location for common_types.xsd such that
its classes are created in a single common place, com.foo for example, and
so that the classes created from A.xsd and B.xsd refer to the helper classes
in this package?