Hi Dominic, The best solution in that case is to use an XML Schema to describe the XML you want as an output and use the Source Generator to generate your beans. When describing the element 'equityLegNotional', you can use the pattern facet to indicate the format you would like to have. (see XML Schema Recommendation Part2 for more information). If you have business logic in your current beans, you can always extend the generated beans to add the business logic. You can find relative topic on the archive on how to add business logic to the generated beans. I plan to add that in the Source Generator documentation but I have no time for that unfortunately right now.
Another solution is to use a mapping file in combination with a customized FieldHandler. The FieldHandler is the object that fills the gap between Castor and your object. It is providing method like getValue() and setValue(Object object) used whil Marshalling and Unmarhsalling. Thus you can write your own FiedHandler and in the getValue method implement some data processing to have the desired output. For more information on using FieldHandler and mapping, I advise you to search in the mailing list for "FieldHandler": http://www.mail-archive.com/[email protected]/ Hope that helps, Arnaud > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 17, 2002 9:40 AM > To: [EMAIL PROTECTED] > Subject: [castor-dev] Double data format > > Hi, > > I'm new to Castor and I apologise if I didn't see a message relating to > this topic already. > I've been sucessfully marshalling a simple bean and some of the propeties > of the bean > are based on the java double primitive type. I've noticed that the > corresponding XML > element data seems to be formatted based upon the output from > java.lang.Double.toString() > method. This yields differing results depending on the size of the number. > > For example, here are 2 different formats based on the java double > primitive type properties of > the marshalled bean. > > <equityLegNotional>1.9335884879157114E11</equityLegNotional> > <interestRateLegNotional>-1639.68993</interestRateLegNotional> > > Ideally I would like to format the numbers to 5 decimal places and without > the exponent. > Does anybody know how to dictate the formatting styles of element data once > the bean has been > marshalled? > > Would appreciate any help....... > > Dominic > > > > This communication is for informational purposes only. It is not intended as > an offer or solicitation for the purchase or sale of any financial instrument > or as an official confirmation of any transaction. All market prices, data > and other information are not warranted as to completeness or accuracy and > are subject to change without notice. Any comments or statements made herein > do not necessarily reflect those of J.P. Morgan Chase & Co., its > subsidiaries and affiliates. > > ----------------------------------------------------------- > 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
