I need to create a collection of java Object where some are of simple Java types like java.lang.String. I would really like to skip the wrapping patb for it would make my job so much easier. Everything works fine until I mark the value elemnt as optional:
<value name="string" style="element" type="java.lang.String"/>
<value name="string" style="element" type="java.lang.String" usage="optional"/>
But it must me marked optional for I want an unordered collection.
The problem is that JiBX binding process gives me an error:
[bind] Error running binding compiler
[bind] *** Error during code generation - please report this error on the JiBX users list so that the condition can be caught during validation ***
[bind] java.lang.IllegalStateException: Internal error: No test for implicit value from collection
[bind] at org.jibx.binding.def.PropertyDefinition.genTest(PropertyDefinition.java:415)
[bind] at org.jibx.binding.def.ValueChild.genMarshal(ValueChild.java:527)
[bind] at org.jibx.binding.def.ValueChild.genContentMarshal(ValueChild.java:687)
[bind] at org.jibx.binding.def.NestedCollection.genContentMarshal(NestedCollection.java:255)
Anyways, I have prepared a simple example with three steps:
1. The working version that doesn't suite me for there the collection is not unordered.
2. The example data file demonstrateing why the working case is not enought.
3. The example of a suitable binding file that gives the exception.
PS! The exception doesn't occur because of the unordered collection but because of the optional value element.