Dhruv,

My guess is that you have a bit of work to do.
Here is how I'd attack it.
Start by forgetting the HashMap for a moment. Create java classes an mapping.xml
to handle a regular multi-occuring list of complex objects.


Then, layer the hash3.zip solution on top of the above.
Use one of the fields in your complex object as the key.
Perhaps contatenate multiple (or all) fields to get a key, like x.getLastName() + 
x.getPostalCode() ...

To understand better, it would help me to see the client code that would use the 
castor objects.

Also, Keith normally has good suggestions for this kind of thing.  Keith?

--Erik

      > -----Original Message-----
      > From: Dhruv Vohra [mailto:[EMAIL PROTECTED]]
      > Sent: Tuesday, January 07, 2003 1:31 PM
      > To: [EMAIL PROTECTED]
      > Subject: Re: [castor-dev] How do I handle java.util.Hashtable
      > 
      > 
      > Dear Erik,
      > 
      >   Thanks for the quick reply and yes I love email more
      > everytime it is productive :). You example did work.
      > However, how would I handle if:
      > 
      > 1. The key and values are complex data types [user
      > defined instead of "String"]. I need to handle these.
      > 
      > 2. In you example the "addChild(Child)" method
      > actually populates the "key" and "value" using the
      > same "Child" object. In my case these "value" object
      > does not contain any attribute which can be set as the
      > "key" [and vice versa].
      > 
      >  How do I work around my case? 
      > 
      > Thanks,
      > Dhruv
      > 
      > --- [EMAIL PROTECTED] wrote:
      > > Dhruv,
      > > 
      > >       Isn't email great?  I couldn't come close to
      > > pronouncing your name.
      > > But with email I can greet you, opening with 'Dear
      > > Dhruv' and you don't know
      > > the difference.
      > > 
      > > Anyway, see if the attached little example suits
      > > your needs.
      > > The class 'Parent' uses a HashMap to store the
      > > keys/values.
      > > 
      > > --Erik
      > > 
      > > 
      > >       > -----Original Message-----
      > >       > From: Dhruv Vohra
      > > [mailto:[EMAIL PROTECTED]]
      > >       > Sent: Tuesday, January 07, 2003 12:45 PM
      > >       > To: [EMAIL PROTECTED]
      > >       > Subject: [castor-dev] How do I handle
      > > java.util.Hashtable
      > >       > 
      > >       > 
      > >       > Hi,
      > >       > 
      > >       >    I have Java Classes that contain
      > > "Hashtable".
      > >       > 
      > >       > a) How do I write a mapping.xml to map both
      > > the key
      > >       > and value of a Hashtable?
      > >       > 
      > >       > b) Any recommended way to write the XML
      > > instace file
      > >       > to reprsent Hashtable: 
      > >       >    . The key should be an attribute and the
      > > value the
      > >       > nodeValue For example:
      > >       >      For a person named DKV who is of age
      > > 23:   
      > >       >      <Person name="DKV">23</Person>
      > >       > 
      > >       >  or
      > >       > 
      > >       >    . <Person>
      > >       >       <name> DKV </name>
      > >       >       <age> 23 </age>
      > >       >      </Person>
      > >       > 
      > >       > 
      > >       > I have to find a solution for exsiting
      > > "working" code
      > >       > and I am new to castor. Please help. The
      > > examples do
      > >       > not talk about Hashtable - only
      > > "collection/List". I
      > >       > could also not find any answer in the
      > > archives.
      > >       > 
      > >       > Thanks,
      > >       > DKV
      > >       > 
      > >       > PS) If this cannot be done then any
      > > workaround?
      > >       > 
      > >       >
      > > __________________________________________________
      > >       > Do you Yahoo!?
      > >       > Yahoo! Mail Plus - Powerful. Affordable.
      > > Sign up now.
      > >       > http://mailplus.yahoo.com
      > >       > 
      > >       >
      > >
      > -----------------------------------------------------------
      > > 
      > >       > If you wish to unsubscribe from this
      > > mailing, send mail to
      > >       > [EMAIL PROTECTED] with a subject of:
      > >       >       unsubscribe castor-dev
      > >       > 
      > >       > 
      > > 
      > 
      > > ATTACHMENT part 2 application/x-zip-compressed
      > name=hash3.zip
      > 
      > 
      > 
      > __________________________________________________
      > Do you Yahoo!?
      > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
      > http://mailplus.yahoo.com
      > 
      > ----------------------------------------------------------- 
      > If you wish to unsubscribe from this mailing, send mail to
      > [EMAIL PROTECTED] with a subject of:
      >         unsubscribe castor-dev
      > 
      > 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to