Hi Erik and Lisa,

I've slightly modified the behavior of the <package> element and I hope
it will fit your needs.
The <package> element allows you to define a mapping between a package
name and a schemaLocation. The schema location is a URI that identifies
your XML Schema.
You have several options:

1- using the absolute URI:
<package>
    <name>foo.bar</name>
    <schemaLocation>file:///home/schemas/myschema.xsd</schemaLocation>
</package>
When processing the schema myschema.xsd, Castor will create a location
for it and the SourceGenerator will simply check that this location
matches the one specified in the binding file.

2- using a relative URI
<package>
    <name>foo.bar</name>
    <schemaLocation>./myschema.xsd</schemaLocation>
</package>

The Source Generator will compute the schemaLocation at runtime using
the user current directory (user.dir property)

3- use the resource name
<package>
    <name>foo.bar</name>
    <schemaLocation>myschema.xsd</schemaLocation>
</package>

In that case every 'myschema.xsd' whatever the URI is will generate
sources in a foo.bar package.

Let me know if it fits your needs,

Arnaud

> -----Original Message-----
> From: Ostermueller, Erik [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 30, 2003 10:13 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] binding file -- <package> element
> 
> I wrote:
>       > Also, is the <package> node in any way a replacement for
>       > the property org.exolab.castor.builder.nspackages?
> When you generate code, the answer is yes.
> 
>       > How about for the SourceGenerator -package command line
>       > parameter?
> Again, when you generate code, the answer is yes, as long as you
> put the same targetNamespace in both your schema and the binding file.
> 
> I have another question, though.  This ns-package mapping would
> be very helpful when unmarshalling.  Is there any code that inspects
> the bindingfile during unmarshalling?
> 
> I want it to detect a ns in an instance doc, locate the corresponding
> java package in the binding file and then unmarshall the data.
> 
> Also, I still haven't answered my original question:
> 
> The binding file html doc says the <package> element allows you "to
define the
> mapping between a schemaLocation attribute and a Java package".
> 
> Does this mean that the following binding file will place
> all generated objects for Customer.xsd into the 'vo' package?
> It's not working for me.
> 
> <cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding";
>              defaultBindingType='type'>
>      <cbf:package>
>           <cbf:name>vo</cbf:name>
>           <cbf:schemaLocation>./Customer.xsd</cbf:schemaLocation>
>      </cbf:package>
> </cbf:binding>
> 
> 
> Thanks,
> 
> Erik
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

Reply via email to