Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JiBX 1.1.6
-
Fix Version/s: None
-
Component/s: core
-
Labels:None
-
Environment:N/A
-
Number of attachments :
Description
I am defining a structure with a text value and an attribute value. When both associated fields are null, I don't want the resulting element to appear in the document. I have marked the structure and the two values as optional. When the two fields are null in my object, I get an empty element in my output.
This is a variation of the case described at http://jibx.sourceforge.net/bugs.html It's really an issue with ambiguity in the binding definition, since there's no way to directly tell JiBX that you don't want the enclosing element unless one or more of the contained values is present. The only way to make this work the way you want is by adding a test-method which will return true if either value is non-null, and false if they're both null.
I'll try to come up with an approach which doesn't require any added user code for v2.