users@jaxb.java.net

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

From: Jean-Marie Condom <jmc_at_meteorage.com>
Date: Thu, 03 Feb 2005 12:15:20 +0100

hello

this pb has been evoked in the past but i have not been able
to apply the solution in my case ; i don't use "import" nor "include"
 since i don't want to have common classes generated within
each package that refer to the common one.

i have the following schema common.xsd which contains
several simple or complex types :

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

<!-- fileopenmodeType -->
<xsd:simpleType name="fileopenmodeType">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="CREATE"/>
    <xsd:enumeration value="APPEND"/>
  </xsd:restriction>
</xsd:simpleType>

<!-- ZeroOrOne -->
<xsd:simpleType name="ZeroOrOne">
....
</xsd:simpleType>

......

those types are refered in others schemas such as configuration_test.xsd ;
configuration_test.xsd looks like this :

<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:attribute name="reconnexion" type="cm:ZeroOrOne" default="0"/>
  <xsd:attribute name="trconnexion" type="cm:ZeroOrOne" default="0"/>
...
  <xsd:attribute name="fileopenmode" type="cm:fileopenmodeType"/>
...

after having ran ant with common.xsd, i run ant with
configuration_test.xsd ;
i get the following message :

Compiling the schema...
Compiling file:/D:/javadev/jaxb/jobs/xml/configuration_test.xsd
[ERROR] the target namespace of the imported schema
"meteorage/jobs/params/common" doesnt agree with the expected value "{1}"
  line 7 of common.xsd

i think that i don't use namespaces correctly

thanks for your help

Jean-Marie

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