Hello, In XML a •boolean• can have the following legal literals {true, false, 1, 0}. However, when mapping 1 to a Boolean (the object), I expect the value to be true, but the value is actually set to false. After debugging through the method calls, it appears that when using a Boolean, the Boolean constructor is called [public Boolean(String s)] and that only compares for the strings true/false not 0 and 1.
We can write a custom marshaller to handle the Boolean case, but it is a sneaky problem. If we change a variable from boolean to Boolean, the mappings will appear to work until we realize the values are off and remember to change the mapping to use the custom marshaller. Any tips on a better way to handle this? Thanks, -Jennifer ----------- Code Samples ----------- /** Sample Class, the comment denotes the value of the variable after unmarshalling */ public class TestClass { private boolean b1; //value is set to true private boolean b2; //value is set to false private boolean b3; //value is set to false private boolean b4; //value is set to true private Boolean b5; //value is set to true private Boolean b6; //value is set to false private Boolean b7; //value is set to false private Boolean b8; //value is set to false !! This is not expected. It should be true } -- Sample XML file -- <Test> <B1>true</B1> <B2>false</B2> <B3>0</B3> <B4>1</B4> <B5>true</B5> <B6>false</B6> <B7>0</B7> <B8>1</B8> </Test> -- Mapping file -- <binding name="TestMap" add-constructors="true"> <mapping name="Test" class="TestClass"> <value name="B1" field="b1"/> <value name="B2" field="b2"/> <value name="B3" field="b3"/> <value name="B4" field="b4"/> <value name="B5" field="b5"/> <value name="B6" field="b6"/> <value name="B7" field="b7"/> <value name="B8" field="b8"/> </mapping> </binding> ____________________________________________________________________________________ Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 ------------------------------------------------------------------------- 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