Hi Corina, The use of 'container=false' is correct but this feature is only available in the CVS version of Castor. Are you using the CVS version or the latest release version?
If you want to update to the CVS version, please refer to http://www.castor.org/cvs.html Or you can wait for the next release that is scheduled next week. Hope that helps, Arnaud -----Original Message----- From: coughlac [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 01, 2002 12:50 PM To: [EMAIL PROTECTED] Subject: [castor-dev] Mapping Collections - Vectors - Using Castor Hi all, I have encountered one more problem. I looked at the mailing list so far and tried a few variations of my mapping file ( collection = "vector" ; collection="enumerate"; container="false" ) but to no avail. I shall explain: I need to create the following xml: <Message> <RequestedReports> <Report Type="Exception"/> <Report Type="COA"/> </RequestedReports> </Message> I also have to use pre-existing java objects (i.e. not created using castors source generator). I have a Message object that contains a Vector of Report objects. This vector represents the RequestedReports element. The code may explain this better: import com.mypackage.Report; import java.util.Enumeration; import java.util.Vector; public class Message { private Vector mRequestedReportsVector; public Message() { this.mRequestedReportsVector = new Vector(); } public void addReport( Report pNewReport) { this.mRequestedReportsVector.add(Report); } public Report getReport( int pNewIndex) { return (Report) mRequestedReportsVector.elementAt(pNewIndex); } public void addReport( Report pNewReport) { this.mRequestedReportsVector.add(Report); } public Enumeration enumerateRequestedReports() { return this.mRequestedReportsVector; } . . . } package com.mypackage; public class Report { private string mType; public Report() { } public void setType( String pNewType) { this.mType = pNewType; } public String getType() { return mType; } . . . } Lastly, I have a mapping file as follows <mapping> <class name="Message"> <field name="mRequestedReportVector" type="com.mypackage.Report" collection="enumerate" container="false" get-method="enumerateRequestedReports"> <bind-xml name="RequestedReports"/> </field> </class> <class name="com.mypackage.Report"> <map-to xml="Report"/> <field name="mType" type="string" get-method="getType" set-method="setType"> <bind-xml name="Type" node="attribute"/> </field> </class> </mapping> However the resulting xml is as follows: <Message> <RequestedReports Type="EXCEPTION"/> </Message> Can anyone tell me if my mapping file is incorrect or if this is a "bug" in castor (i.e. that I will have to wrap my vector into it's own class in order to give it an element tag in the XML)??? Thanks Corina Coughlan ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
