I just started using Castor to convert Objects to XML and back and have a couple of questions
I have the following Objects public class Member { private int iID private Level iLevel; // Constructor is package-private Member(theMID, int theLID) {iID = theID; iLevel = new Level(theLID);} public int getID() {return iID;} public Level getLevel() {return iLevel;} } public class Level { private int iID; // Constructor is package-private Level(int theID) {iID = theID;} public int getID() {return iID;} } public class MemberFactory() { public Member createMember(int theMID, int theLID) {return new Member(theMID, theLID);} } I created an xml mapping file <mapping> <class name="test.Member" verify-constructable="false"> <map-to xml="MEMBER" /> <field name="ID" type="java.lang.Integer" > <xml name="mid" node="attribute" /> </field> <field name="Level" type="test.Level" > <xml name="lid" node="attribute" /> </field> </class> <class name="test.Level" verify-constructable="false"> <map-to xml="LEVEL" /> <field name="Id" type="java.lang.Integer" > <xml name="lid" node="attribute" /> </field> </class> </mapping> 1. What I'd like to get on Marshalling a Member is an XML that looks like <Member mid="2" lid="2"> ie. I want the level ID, not the Level object. Do I have to write my own FieldHandler for this or is there some way to do this in the XML Mapping file? 2. I want to use the MemberFactory for creating the Member. Again, I suspect that I have to write my own FieldHandler. Right? 3. I'd really like to see constructors from elements. I don't like to have set methods in my classes unless really required. So using Castor is making me change my design philosophy. There are no sample files on how to write the FieldHandler. I have gone through the archives and got very confused. Is there any sample code for FieldHandlers somewhere. Thanks Regards Milind ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev