The style of data should be Text and don't put a Name parameter. The following should do it: <mapping name="attachment" class="Attachment"> <value usage="optional" style="text" get-method="getAttachment" set-method="setAttachment" ns="http://www.db.com/tpv/ws/base"/> <value usage="optional" name="contentType" style="attribute" get-method="getContentType" set-method="setContentType" ns="http://www.w3.org/2005/05/xmlmime"/> </mapping>
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Häfemeier, Frank Sent: Sunday, June 10, 2007 1:32 PM To: jibx-users@lists.sourceforge.net Subject: [jibx-users] Binding question to style 'attribute' and primitivedatatype Hi, I try currently to define a binding for the following XML: <attachment> <data contentType="application/pdf">...</data> </attachment> the corresponding java class: public class Attachment { private byte[] data; private String contentType; /* corresponding getter/setter defined */ } I tried the following binding: <mapping name="attachment" class="Attachment"> <value usage="optional" name="data" get-method="getAttachment" set-method="setAttachment" ns="http://www.db.com/tpv/ws/base"/> <value usage="optional" name="contentType" style="attribute" get-method="getContentType" set-method="setContentType" ns="http://www.w3.org/2005/05/xmlmime"/> </mapping> But this binding is not correct. After marshalling I get the following XML: <attachment contentType="application/pdf"> <data>...</data> </attachment> Can anyone point me to the right binding to marshall the attribute 'contentType' to the XML element 'data' and not to 'attachment'? The binding is only necessary for marshalling. Do I have to define a special serializer or cis it possible to do out of the box? Mit freundlichen Grüßen Frank Häfemeier Senior IT-Consultant LogicaCMG GmbH & Co KG Main Airport Center (MAC) Unterschweinstiege 10, 60549 Frankfurt Tel: +49-69-26499-0 mailto:[EMAIL PROTECTED] Am Sandtorkai 72, 20457 Hamburg Handelsregister AG Hamburg HRA 96547 persönlich haftender Gesellschafter: LogicaCMG Verwaltungs GmbH Handelsregister AG Hamburg HRB 82051 Geschäftsführer: Torsten Strass (Vors.) / Serge Dubrana / Thomas Elsner / Andreas Manganaro This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users