Hi Andreas,
Schwab, Andreas wrote: > Hello Werner, > > First my apologies for having provided so few information. No problem, but I prefer to have a fuller context available before answering questions related to Castor. It was due to the generality of my question. > We are using Castor in its version 1.1.2 and Java 1.4. > > 1. How can I tell castor that there is a customized binding > (specified in the binding.xml) that he should use when generating the > java code. Do I have to reference the binding.xml in the source.xsd > (see below for my example) or is there a convention that the binding > is in a file called binding.xml in the same directory as the > source.xsd? How are you trigegring source coe generation ? In all options available (command line, Ant task, Maven plugin), there's a property available to define a custom binding file. > 2. Concerning the map to be generated: > > I have in the source.xsd something like: > > <xs:complexType name="TextProperties"> <xs:sequence> <xs:element > name="formatMap" type="rep:FormatMapElement" maxOccurs="unbounded"/> > </xs:sequence> </xs:complexType> > > <xs:complexType name="FormatMapElement"> <xs:attribute name="key" > type="xs:string"/> <xs:attribute name="value" type="xs:string"/> > </xs:complexType> > > In the binding xml I give information like: <binding > xmlns="http://www.castor.org/SourceGenerator/Binding" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding > binding.xsd"> > > <elementBinding name="/TextProperties/formatMap"> <member > collection="map"/> </elementBinding> </binding> Okay, I see where you are coming from now. But can we try to address things step by step. Let's see what code gets generated when applying your binding file, and if the output still is not acceptable to you, we continue our conversation ? > > I hope this additional information is helpful. > > Thanks Andreas > > > -----Original Message----- From: Werner Guttmann > [mailto:[EMAIL PROTECTED] Sent: Dienstag, 3. Juni 2008 11:36 > To: [email protected] Subject: Re: [castor-user] FW: > Codegeneration using a customized binding > > Andreas, > > it's a bit difficult to provide you with answers based upon the > information you have provided (so far). As such, can you please try > to provide us with sample XML schema fragments and an idea of a > binding that shows what you are trying to achieve ? > > E.g. show us a complex type definition, and highlight the e.g. > multi-valued element definition for which you want to change the > collection type to map. > > Thanks Werner > > Schwab, Andreas wrote: >> Hello, >> >> >> >> I try to achieve a customized binding with a binding.xml to let a >> sequence become a map in the generated code. >> >> I read especially >> >> http://www.castor.org/srcgen-example.html#Non-trivial-real-world-example >> >> >> before. >> >> Here I have two problems: >> >> 1. How do I have to reference the binding.xml? 2. How is the key >> and value part of the map determined by Castor? >> >> >> >> Mit freundlichen Grüßen Andreas Schwab >> >> >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

