Earl,
Since you know how to marshal attributes, using node="attribute", then it's easy to understand how to do the same for text content using node="text": <field name="premiumAmount" type="long"> <bind-xml node="text"/> </field> --Keith [EMAIL PROTECTED] wrote: > > I'm new to Castor and to XML, but I REALLY like Castor and have been > testing it for marshalling and unmarshalling Java objects. It works well > with our object model, which I consider to be very complex. > > However, I have a user that wants me to send output to them in > the following format. Is there a way that I can accomplish this in > a mapping file. I understand how to map the attributes. What I > don't understand is how I would marshal the values 1000 and 2000 > in the following example. > > (BTW I won't need to unmarshal this object.) > > <Premiums> > <premiumsDetail Age="47" Year="2">2000</premiumsDetail> > <premiumsDetail Age="46" Year="1">1000</premiumsDetail> > </Premiums> > > I haven't written the java objects yet, but they will look > something like this: > > public class Premiums { > ... > public PremiumsDetail[] premiumsDetail = null; > ... > public PremiumsDetail[] getPremiumsDetail() { > //create array of PremiumDetail objects > PremiumsDetail[] premiumsDetailArray = null; > // add PremiumsDetail objects to array > .... > return premiumsDetailArray; > } > } > > public class PremiumsDetail { > public String age=null; > public String year=null; > public Long premiumAmount=0; > ...... > public String getAge() { .... } > public String getYear() { .... } > public String getPremiumAmount() { .... } > } > > In this case, the value of premiumAmount is what I want > to be the element value of premiumsDetail, while age and year are > attributes of the premiumsDetail element. > > Is this possible? Could, for example, the bind-xml name be blank for > the premiumAmount field? > > If not, is this the kind of thing I could do with XSLT > (remove the premiumAmount element tags) if I was smart enough > to learn it? > > Thanks, > > Earl Armstrong, CLU, FLMI, ACS, AIAA > __________________________________ > IS Individual Life Systems Team - 3A-AS > LIFE-COMM New Business, NextGen > Protective Life Corporation > Phone (205)268-2965 Fax (205)268-3474 > > ----------------------------------------- > Confidentiality Notice: This e-mail communication and any attachments may contain > confidential and privileged information for the use of the designated recipients > named above. If you are not the intended recipient, you are hereby notified that you > have received this communication in error and that any review, disclosure, > dissemination, distribution or copying of it or its contents is prohibited. If you > have received this communication in error, please notify me immediately by replying > to this message and deleting it from your computer. Thank you. > > ----------------------------------------------------------- > 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