Hi, Robby, Thank you very much! After I read your sample mapping file and I successfully wrote my XML mapping file. It works!
I just renamed some element names in your sample mapping file and followed the same way your sample gave. My mapping file is simpler as I don't have other class objects. Best regards Jian -----Original Message----- From: Pelssers, Robby, VF-NL [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 01, 2006 10:58 PM To: [email protected] Subject: RE: [castor-user] Mapping File for Hashtable member in a class Are you planning on mapping to an xml-file? Can you give me an example of what the resulting xml-file would look like? Maybe I could try to give you an idea of what the mapping should look like. Have a look at this examplesnippet: Cheers, Robby Pelssers ------------------------------------------------------------------------ --------------------------- /* * Created on Feb 20, 2006 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package nl.vodafone.castorbinding.demo; import java.util.Hashtable; /** * @author PelsserR * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Items { private Hashtable itemlist; public Items(){ } /** * @return Returns the itemlist. */ public Hashtable getItemlist() { return itemlist; } /** * @param itemlist The itemlist to set. */ public void setItemlist(Hashtable itemlist) { this.itemlist = itemlist; } } ------------------------------------------------------------------------ --------------------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Items> <MyItem id="1"> <Item> <id>1</id> <description>desc1</description> <supplier>supp1</supplier> <contact>cont1</contact> </Item> </MyItem> <MyItem id="2"> <Item> <id>2</id> <description>desc2</description> <supplier>supp2</supplier> <contact>cont2</contact> </Item> </MyItem> </Items> ------------------------------------------------------------------------ --------------------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <mapping> <description>maps items.java to items.xml</description> <include href="item_mapping.xml"/> <class name="nl.vodafone.castorbinding.demo.Items"> <map-to xml="Items"/> <field name="Itemlist" collection="hashtable"> <bind-xml name="MyItem"> <class name="org.exolab.castor.mapping.MapItem"> <field name="key" type="java.lang.String"> <bind-xml name="id" node="attribute"/> </field> <field name="value" type="nl.vodafone.castorbinding.demo.Item"> <bind-xml name="Item"/> </field> </class> </bind-xml> </field> </class> </mapping> -----Original Message----- From: Jian Shu [mailto:[EMAIL PROTECTED] Sent: donderdag 2 maart 2006 0:44 To: [email protected] Subject: [castor-user] Mapping File for Hashtable member in a class Hi, I am very new to the castor usage. I would like to write a mapping file for the class below. After reading the documentation, I still failed to do so. I have to seek your very help. Thank you very much in advance! public class XmlHashTable { Hashtable ht; public XmlHashTable() { } public XmlHashTable(SgNodeStateTable table) { ht = (Hashtable)table; } public void setHt(Hashtable ht) { this.ht = ht; } public Hashtable getHt() { return this.ht ; } } Best regards, Jian ------------------------------------------------- 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] -------------------------------------------------

