You can't do that with your xml the way it is now. If you are in a position to change the xml format then yes. The issue is that you are using different element names for start and end dates in customer and product. Those differences are going to need to be specified somewhere, so that JiBX knows when to expect manufacture-date and when to expect joining-date for example (or when to write them out). Conceivably you could write custom marshall/unmarshall code to handle it, but I'm not sure what that would buy you (beyond a slightly smaller binding) since you'd have to use java code to define the exact same mapping logic that you pulled out of the binding.
Mocky -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ruchik Bhatt Sent: Wednesday, July 20, 2005 8:37 AM To: [email protected] Subject: RE: [jibx-users] Mapping multiple elements to one class and using it as datatype Hi, Thanks for the reply. But is there a way where I hava a mapping with label and reuse it for the product and the customer ? Thanks Ruchik --- Mocky Habeeb <[EMAIL PROTECTED]> wrote: > JiBX handles this situation with structures. The > structure basics are > explained here: > http://jibx.sourceforge.net/tutorial/binding-structures.html > Information on how to convert different date formats > can be found here: > http://jibx.sourceforge.net/details/conversions.html > and here: > http://jibx.sourceforge.net/details/format-element.html > > By way of example however, this binding file: > > <binding value-style="element"> > <mapping name="store" class="Store"> > <collection field="products" > item-type="Product"/> > <collection field="customers" > item-type="Customer"/> > </mapping> > > <mapping name="product" class="Product"> > <value name="name" field="name"/> > <structure field="life"> > <value name="manufacture-date" field="startDate"/> > <value name="expiry-date" > field="endDate"/> > </structure> > </mapping> > > <mapping name="customer" class="Customer"> > <value name="name" field="name"/> > <structure field="membership"> > <value name="joining-date" > field="startDate"/> > <value name="end-date" field="endDate"/> > </structure> > </mapping> > </binding> ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
