Can anyone provide any insight into this?  Other than my 
workaround, I cannot seem to find a solution or explain the 
bahvior I am seeing....

TIA!

---------Original Message---------

Hello:

I have a document that requires serialization of boolean values
in a 'yes' and 'no' format.  I have defined  a format in my
binding.xml as follows to accomplish this trivial conversion:


  <format type="boolean" label="yesNoBoolean" 
        serializer="ConversionUtils.serializeYesNoBoolean"
        deserializer="ConversionUtils.deserializeYesNoBoolean"/>

I then reference the format in my mapping as follows:

    <value style="element" name="isGateway"
get-method="isGateway" set-method="setGateway"
                format="yesNoBoolean" usage="optional"/>

When I test a test-case input document via the JiBX roundtrip or
my own JUnit test case this works just fine if (and only if) the
underlying boolean is true.  As soon as I test with a false
value, the serialization process no longer creates the 
associated
element.  I presume that this may be some sort of optimization 
on
part of the usage=?optional? attribute attempting to optimize 
the
output or something?  However, this causes the roundtrip to fail
as well as my JUnit test case which are both expecting to see 
the
attribute with a specified value.

I have debuged the yesNoBoolean serializer and deserializers and
have therefore verified that the serializers are never called
when the underlying value is false (only when true) and that 
they
are performing as would be expected otherwise and without 
failure.

I also tried specifying a default=?no? on the format.  While 
this
did not produce any errors in and of itself, it also did not fix
the roundtrip or JUnit test case failures.

Finally, and most telling, if I remove the usage=?optional? from
the value statement in the mapping, all works fine and as
expected.  However, this is not what I need, as this element
value is truly optional.

Is this a known feature/bug relative to the combination of 
format
and optional values?  Am I missing something else?  Is there a
way to achieve the truly optional behavior for the value, while
using the yeNoBoolean format.

TIA!


----------------------------------------------------------------
--------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited
royalty-free distribution of the report engine for externally 
facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users



------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to