No that was just enough information. I was using the SourceGenerator
with the binding file and the property generateMappingFiles set to true.
I think I originally had some trouble unmarshalling the Java Objects, I
will have to recheck that by removing the code that is trying to use the
mapping files.

Thanks, I will let you know if I still have trouble.

Barbara


-----Original Message-----
From: Stephen Bash [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 03, 2006 8:30 AM
To: [email protected]
Subject: Re: [castor-user] mapping and binding

Barbara-

I'm not much of an expert on the binding-file side, but I use mapping
files all the time.  The short answer is no, you don't need both, but
yes, they both describe Java object <-> XML relations.

In general, I believe, the binding file is used to create Java code
(that can then be compiled and used in an application) from an XML
Schema.  The binding file is most often (only?) used with the Castor
SourceGenerator, which creates Java classes that model an XML schema,
at which point Castor also creates extra classes (ClassDescriptors and
FieldDescriptors) that describe how the Java objects "map" to XML.

The mapping file provides an alternate method for the user to specify
how Java objects transform into XML content.  I tend to think of this
as how one starts with a Java object model and then creates the XML
structure from it, but it is much more flexible than that.

Where the two methods somewhat meet is the
ClassDescriptor/FieldDescriptor level.  When a user loads a mapping,
Castor reads the mapping file and internally creates the appropriate
descriptors.  If the SourceGenerator was used, the descriptors exist
as compiled classes and are instantiated as they are needed (thus the
mapping file usually isn't required).

That might be more information than you needed, but hopefully it
answers the question.  Let us know if you have further questions.

Stephen

On 3/3/06, Barbara Prechtl <[EMAIL PROTECTED]> wrote:
>
>
>
> To whom it may concern:
>
>
>
> I was wondering what the difference between a mapping file and a
binding
> file is.
>
>
>
> Is this correct:
>
>
>
> A mapping file is used for writing java objects to xml.
>
> A binding file is used to read xml to java objects.
>
>
>
> They both seem to describe the element to object relation. Are both
needed?
>
>
>
> Thanks,
>
> Barbara

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

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

Reply via email to