users@jaxb.java.net

Re: how to refer to a common schema without duplicating entries found in the common namespace

From: Jean-Marie Condom <jmc_at_meteorage.com>
Date: Tue, 08 Feb 2005 11:30:12 +0100

Hello

sorry, i am not enough clear

> Sorry, I'm still bit confused.
>
> Are you compiling schema A and B at the same time? If not, that's the
> reason you get two copies, and it sounds very similar to the issue
> Jerry raised in the past few days.
>
> Is there any reason in your case as to why you can't compile them all
> at once?

it's right that i compile schemas common.xsd, A and B one after another
first i compile common.xsd which generate classes under
meteorage/jobs/params/common ;
the heading of common.xsd is defined as follows :

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           targetNamespace="meteorage/jobs/params/common"
           xmlns="meteorage/jobs/params/common"
           jaxb:extensionBindingPrefixes="xjc"
           jaxb:version="1.0">

then i compile schema A where some types refer to types defined in
common.xsd ;
the heading of schema A is :

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           targetNamespace="meteorage/jobs/params/configuration"
           xmlns="meteorage/jobs/params/configuration"
           xmlns:cm="meteorage/jobs/params/common"
           jaxb:extensionBindingPrefixes="xjc"
           jaxb:version="1.0">

   <xsd:import schemaLocation = "common.xsd"
namespace="meteorage/jobs/params/common"/>

when i compile this schema A, the same classes which already exist under
meteorage/jobs/params/common
are re-generated under meteorage/jobs/params/configuration

the same behaviour happens with schema B

if i use <xsd:include instead of <xsd:import compiling schema A
produces an error since
common.xsd and A are not in the same namespace :
[ERROR] the target namespace of the included schema
"meteorage/jobs/params/common"
doesnt agree with the expected value "{1}" line 7 of common.xsd

what would be fine is to have only one set of common classes for
instance under
meteorage/jobs/params/common and that the compilation of schema A takes into
account this set of classes so that they are not generated again under
meteorage/jobs/params/configuration

by compiling all at once do you mean that in one build file i can get
the generation
i am looking for, that is :
-common classes under meteorage/jobs/params/common
-classes of schema A under meteorage/jobs/params/configuration
-classes of schema B under another directory such as
meteorage/jobs/params/context

thanks a lot

Jean-Marie

-- 
Jean-Marie Condom
Software development team
Sté Météorage
2 av Angot
64053 PAU
France