Hi all,

I want to marshal a Java object that has a collection property putting all the elements of the collection in one wrapper element, using the location attribute. The problem is that the wrapper element is still generated even if my collection is null or empty.
For example:

public class A {
   private List<B> bs;
}

public class B {
   private String name;
}

The mapping for the two classes is:

   <class cst:name="A">
       <map-to cst:xml="a"/>
       <field cst:name="bs" cst:type="B" cst:collection="collection">
           <bind-xml location="bs" auto-naming="deriveByClass"/>
       </field>
   </class>
   <class cst:name="B">
       <map-to cst:xml="b"/>
       <field cst:name="name" cst:type="java.lang.String">
           <bind-xml name="name" node="element"/>
       </field>
   </class>

And the marshalling output for an A class with no B elements is:
<a>
   <bs/>
</a>

I've tried using the nillable="true" attribute for the 'bs' field of my A class, but this didn't solve the problem. I've also looked through the mail archive for anything similar but couldn't find a solution to my problem.
BTW I'm using the 0.9.7 release but if needed i can switch to 0.9.9 :)

Thanks in advance.
Cristiana.

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to