Title: RE: [castor-dev] SourceGenerator -- package mapping with IMPORT


-----Original Message-----
From: Brian Goetz [mailto:[EMAIL PROTECTED]]
Sent: 11 December 2002 02:45
To: [EMAIL PROTECTED]
Subject: [castor-dev] SourceGenerator -- package mapping with IMPORT


Hi.  I'm using Castor SourceGenerator, version 0.9.4.1.  I want to break up
my XSD file so that I have one package for generic types, and multiple
other files, each in their own package, which can import them.

In this example, I have two XSD files, a.xsd and b.xsd.  b.xsd defines a
single simple type, bstring, which extends xsd:string.  a.xsd defines a
single element, which has an attribute of type b:bstring.

My files are below, two xsd files and a castorbuilder.properties
file.  Each gets mapped to their own package by the properties file.  My
question is this: when I run SourceGenerator on a.xsd, which references the
type b:bstring, shouldn't the generated AElement.java file have this:

     public com.b.types.Bstring getName()

instead of this:

     public com.a.types.Bstring getName()
?

I thought that was the whole point of using import instead of include --
that you would reference a type from another schema, not suck that type
into the current schema.  But when I run SourceGenerator, it generates the
Bstring type and descriptor in package com.a and references it from com.a,
not com.b.

Am I misunderstanding how this is supposed to work?  Is there a way to do
what I'm trying to do, which is to generate classes that references the
classes generated from the B schema?

Thanks!


a.xsd
-----

<xsd:schema
     targetNamespace='a'
     xmlns:b='b'
     xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

     <xsd:import id='b' schemaLocation='b.xsd' namespace='b' />

     <xsd:element name='a-element'>
         <xsd:complexType>
             <xsd:attribute name='name' type='b:bstring' use='required'/>
         </xsd:complexType>
     </xsd:element>

</xsd:schema>

b.xsd
-----

<xsd:schema
     targetNamespace='b'
     xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

     <xsd:simpleType name="bstring">
         <xsd:restriction base='xsd:string'>
             <xsd:enumeration value='value'/>
         </xsd:restriction>
     </xsd:simpleType>
</xsd:schema>

castorbuilder.properties
------------------------

org.exolab.castor.builder.nspackages=\
  a=com.a,\
  b=com.b



getName method from AElement.java
---------------------------------

     public com.a.types.Bstring getName()
     {
         return this._name;
     } //-- com.a.types.Bstring getName()

--
Brian Goetz
Quiotix Corporation
[EMAIL PROTECTED]           Tel: 650-843-1300            Fax: 650-324-8032

http://www.quiotix.com

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to