Michael Greene wrote:
Keith,

I think that what I am trying to do is different.  I have a schema,

You should be able to do it with using the castorbuilder.properties file, but you'll need to switch from <xs:include> to <xs:import>

(see my comments below)

Schema1.xsd with the following:

<xs:include schemaLocation="IncludedSchema.xsd"/>


You'll need to change this to <xs:import> instead of include if you want to have separate namespaces. Castor treats include basically as inlining.

(more comments below)

I would like to generate source code so that all code generated from
Schema1.xsd will go under the package I provide to the Source Code
Generator, and all code genereated from IncludedSchema.xsd will go under
a package defined in the binding file.  I did not get the modification
to the castorbuilder.properties file to work.

org.exolab.castor.builder.nspackages=\
IncludedSchema.xsd=this.schema.has.unique.package,\
IncludedSchema2.xsd=so.does.this.one

Please let me know if you think I am missing something.

You've setup the property incorrectly. You need to be using the targetNamespace of the schema, such as:

org.exolab.castor.builder.nspackages=\
namespace1=this.schema.has.unique.package,\
namespace2=so.does.this.one


Where namespace1 and namespace2 are defined in your respective schema files:

schema1.xsd
<xs:schema ... targetNamespace="namespace1" ...>
  ...
   <xs:import schemaLocation="schema2.xsd"/>
  ...
</xs:schema>

schema2.xsd:
<xs:schema ... targetNamespace="namespace2" ...>
  ...
</xs:schema>

Hope that helps,

--Keith


Michael


[EMAIL PROTECTED] 09/13/05 12:51 AM >>>

Michael,

I've actually never used the binding file for that, but try setting the

namespace to package mapping in the "/org/exolab/castor/builder/castorbuilder.properties" file, that's where I normally do it.

There is an example in the properties file. Look for the following and

simply uncomment and modify the namespaces + packages:

# XML namespace mapping to Java packages
#
#org.exolab.castor.builder.nspackages=\
http://www.xyz.com/schemas/project=com.xyz.schemas.project,\ http://www.xyz.com/schemas/person=com.xyz.schemas.person
Hope that helps,

--Keith

Michael Greene wrote:

Hello,

I am currently using Castor via JBuilder 2005 to bind a schema that
includes many other schemas, which in turn include other schemas.

In

doing so, I get many naming conflicts, resulting in classes being
overwritten.  I attempted to use the package element in the binding

file

to create some "personal space" for all of the created classes, but

the

package element does not seem to be given notice by the source
generator.  The following code is an example of my binding file,

with

the name and schemaLocation elements generalized.

<binding>
 <package>
   <name>
     package.name
   </name>
   <schemaLocation>
     schema.xsd
   </schemaLocation>
 </package>
</binding>

I have tried three variations of setting the schemaLocation element:


full URI in the format of 'file:///C:/Folder/File.xsd', relative

path

using ./ (relative to what I don't know....working directory, I'm
guessing), and the schema as it is identified by the <xsd:include/>
element in the schema file supplied to the source generator.

I have successfully used the namingXML element in the binding file,

so

I know the binding file is at least being used.  I am having no

success

with the package element.

Thank you,
Michael


------------------------------------------------------------------------------

E-Mail correspondence to and from this sender may be subject to the
North Carolina Public Records Law, and may be disclosed to third

parties.

------------------------------------------------------------------------------

+-+-NCDOR2005-+-+

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED] -------------------------------------------------





-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED] -------------------------------------------------


-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------




-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to