Stephen et alias, let me just try to clarify a few items in-line.
Werner Stephen Bash wrote: > Bin- > > Let me first say I'm in no way a SourceGenerator guru, but I'll try to > answer your questions. I'm not sure when the binding file was first > implemented in Castor, but I've only been using it since 0.9.5.4, so > you're predating me already :-) But to your other point, yes, the > binding file is an attempt to give control over the generated source > based on the XML Schema. Correct. A binding file needs to be used when there's ambiguity in your XML Schema when it comes to naming collisions of e.g. <complexType> definitions and/or global element definitions. In such circumstances, a binding file allows you to instruct the source generator to use e.g a particular Java class name for a generated class, etc. > I don't believe the mapping file is used at > all during SourceGeneration. Correct. And finally, having not worked with the > SourceGenerator much, I can't really help with your specific problem > (array vs. HashMap). Sorry. > > Hopefully someone else can chime in and help out with the specific issue. > > Stephen > > > On 3/3/06, bin lin <[EMAIL PROTECTED]> wrote: >> I am also confusing on this point: >> >> I have been trying to create a PolicyStore class >> containing a collection of policy objects. >> >> 1) First I used xsd directly to generate src via >> srcGenerator. However it create a array of policy >> objects in policyStore by default, while I need >> hashMap as container for policies so that I can query >> by key. >> >> 2) Then I created a mapping file by using O2XMapper >> and tried to use this mapping file to redefine the >> container as Map. >> >> 3) I looked around srcGenerator cmd option and found a >> option named "binding-file". I took for granted >> thought it should be mapping file. The result was that >> srcGenerator refused to accept mapping file and threw >> exception >> >> 4) I realize that binding file must be new feature (I >> couldn't find this option in castor0.9.3) >> >> My question is if there is a way to generate source by >> using mapping file as fine-grain control? If not, is >> there a tool to generate binding file automatically? >> >> ~Bin >> >> --- Stephen Bash <[EMAIL PROTECTED]> wrote: >> >>> 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 >> >> __________________________________________________ >> Do You Yahoo!? >> Tired of spam? Yahoo! Mail has the best spam protection around >> http://mail.yahoo.com >> >> ------------------------------------------------- >> 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] -------------------------------------------------

