Ralf,
On Fri, 2006-01-06 at 00:33 +0100, Ralf Joachim wrote: > Hi Sandeep, > > why don't you walk the object tree after unmarshalling to set the > GUID's. For me this seams to be the simplest solution or do I miss anything? Thank you for your valuable suggestion. That would indeed be the quickest (atleast that comes to mind) solution. But, in the long run we would rather have the whole process be transparent and not having to create extra custom code. Besides the Unmarshaller should be able to deal with such things to produce a *complete* Object/s from the XML. I did have something in mind with the custom field handlers that Keith Visco replied with in regards to this question. Thanks again. --Sandeep Khanna > > Regards > Ralf > > > Sandeep Khanna schrieb: > > >Hi All, > > > >Given the following visual representation of Object relationships & the > >relevant Castor mapping: > > > >ClientDcl > >|-ClientGUID > >|-FirstName > >|-LastName > >|-... > >|-AddressRoleDcl > > |-AddressRoleGUID > > |-ClientGUID > > |-AddressGUID > > |-... > > |-AddressDcl > > |-AddressGUID > > |-... > > > >I would like to unmarshall the following XML: > > > ><?xml version="1.0" encoding="UTF-8"?> > ><AsClient> > > <ClientGUID/> > > <FirstName>Sandeep</FirstName> > > <LastName>Khanna</LastName> > > <Fields> > > <AsClientField> > > <ClientGUID/> > > <FieldName>ExtraFieldName</FieldName> > > <FieldTypeCode>02</FieldTypeCode> > > <TextValue>ExtraFieldValue</TextValue> > > </AsClientField> > > </Fields> > > <AddressRoles> <!-- Map --> > > <AsAddressRole> <!-- value --> > > <AddressRoleGUID/> > > <AddressGUID/> > > <ClientGUID/> > > <AddressRoleCode>2</AddressRoleCode> <!-- key --> > > <AsAddress> > > <AddressGUID/> > > <AddressLine1>81 ALEXANDRA DRIVE</AddressLine1> > > <AddressLine2/> > > <AddressLine3/> > > <addressLine4/> > > <City>NEW BRITIAN</City> > > <StateCode>07</StateCode> > > <CountryCode/> > > <PostalID>06789</PostalID> > > <Fields> > > <AsAddressField> > > <ClientGUID/> > > <FieldName/> > > <FieldTypeCode>02</FieldTypeCode> > > <TextValue/> > > </AsAddressField> > > </Fields> > > </AsAddress> > > </AsAddressRole> > > </AddressRoles> > ></AsClient> > > > >We have a GUIDGeneratorUtl class that creates unique GUIDs. We would > >like to use it from within the Castor framework to generate the GUID and > >set it in the above Object relationships. > > > >Questions: > >1) How do I setup/use a GUID generator class from within the Castor > >mapping file. > >2) As per the above visual Object relationship, we would require the > >ClientGUID that was generated and set on the ClientDcl object to be used > >while setting the ClientGUID attribute on the AddressRoleDcl object > >contained in the ClientDcl instance. > >3) As per the above visual Object relationship, > >AddressRoleDcl.AddressGUID needs to be set from the > >AddressDcl.AddressGUID which would be generated only after we unmarshall > >or parse the AddressDcl element/node. One way would be to unmarshall the > >AddressDcl element/node first to have the AddressGUID ready before > >unmarshalling AddressRoleDcl element/node. > > > >Any comments, suggestions, pointers would be helpful. > > > >--Sandeep Khanna > > > > > >------------------------------------------------- > >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] > ------------------------------------------------- > ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

