Hi Vikram, I don't understand how you're getting the output:
<?xml version="1.0" encoding="UTF-8"?> <MyCustomer> <first-name>Aaron</first-name> <last-name>Smith</last-name> <Address/> </MyCustomer> with this binding. You *should* get: <?xml version="1.0" encoding="UTF-8"?> <MyCustomer> <Address> <first-name>Aaron</first-name> <last-name>Smith</last-name> </Address> </MyCustomer> If you don't want the <Address> element present at all, just remove name="Address" from the <structure> element in the binding. - Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Vikram Sharma wrote: > 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 > ------------------------------------------------------------------------- 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