Is it possible with JIBX to NOT marshal the <structure> element if it contains 
null element values?
With the example provided below, I get an empty <Address> element when 
marshalling an object with only the firstName & lastName as not null values.
------------
Binding XML
------------
<mapping class="Customer" ordered="false" name="Customer">

<value style="element" name="first-name" field="firstName" usage="optional" />
<value style="element" name="last-name" field="lastName" usage="optional" />

<structure name="Address" usage="optional" ordered="false">
<value style="element" name="address-line-1" field="address1" usage="optional" 
/>
<value style="element" name="city" field="city" usage="optional" />
<value style="element" name="state" field="state" usage="optional" />
<value style="element" name="zip" field="zip" usage="optional" />
</structure>

</mapping>

----------
Class
-----------
public class Customer {
private String firstName;
private String lastName;
private String address1;
private String city;
private String state;
private String zip;

//-- Get & set methods

}
 
------------------------
Current Marshlled Output - if only firstName & lastName are not null
------------------------
<?xml version="1.0" encoding="UTF-8"?>
<MyCustomer>
<first-name>Aaron</first-name>
<last-name>Smith</last-name>
<Address/>
</MyCustomer>
------------------------
Expected Marshlled Output ( <Address/> is undesirable)
------------------------
<?xml version="1.0" encoding="UTF-8"?>
<MyCustomer>
<first-name>Aaron</first-name>
<last-name>Smith</last-name>
</MyCustomer>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to