I've thought about adding more choices to the usage value to make this automatic ("optin" and "optout", perhaps). I'll try to get these in for beta 4, unless I come up with something more general - there does seem to be a need at times to use slightly different bindings for unmarshalling vs. marshalling, so I've considered doing something like:
<structure> ... <input> <!-- definitions for unmarshalling this portion of the structure --> ... </input> <output> <!-- definitions for marshalling this portion of the structure --> ... </output> ... </structure>
You could always do the same thing using two separate binding definitions (one input-only, the other output-only), but that requires a lot of duplication. On the other hand, I don't know that this <input>/<output> element pairing is really something I like all that well. I'm open to further suggestions...
- Dennis
Cameron Taggart wrote:
http://jibx.sourceforge.net/binding-attributes.html
default: Gives the default value for a conversion. This is only allowed for optional properties. If not specified, the default for primitive types is the same as the member variable initial state defined by the JLS, and for object types is "null".
So if the <value> is optional and it matches the default value, then it will not show up. So if "0" is a legal status code and you want it to show up, make the default "-1" or something that is not a valid status code.
<value name="statusCode" field="statusCode" usage="optional" default="-1"/>
Cameron
Reiner Nix wrote:
Hi,
on marshalling an integer variable 'statusCode' with value 0 the written XML document does not contain a line '<statusCode>0</statusCode>'. Instead this the line is completely omitted. The same is on boolean value 'false' and string value 'null'.
My question: how can I still force writing those value elements?
Below a snippet of the binding definition.
<mapping name="XmlApplicationMessage" class="ApplicationMessage"> <value name="statusCode" field="statusCode" usage="optional"/> </mapping>
Many thanks for any answer, Reiner
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users
