Hi.

I have encountered an issue regarding Collection. When the Collection is
empty then the corresponding XML element does not appear when I marshall
from Object to XML.

Here is my binding
<binding>
    <mapping name="dpresponse"
class="com.xyz.research.analytics.gse.dpresponse.DpResponse">
        <collection field="responseList"
create-type="java.util.ArrayList">
            <structure name="datarequest"
type="com.xyz.research.analytics.gse.dpresponse.DataResponse">
                <value name="measures"
field="measures"/>
                <value name="periods" field="periods"/>
                <value name="latestdate"
field="latestDate"/>
                <value name="requesteddate"
field="requestedDate"/>
                <collection field="dataList"
create-type="java.util.ArrayList">
                    <structure name="data"
type="com.xyz.research.analytics.gse.dpresponse.Data">
                        <value name="name"
field="name"/>
                        <value name="values"
field="values"/>
                        <value
name="historyexpression" field="historyExpression"/>
                    </structure>
                </collection>
            </structure>
        </collection>
    </mapping>
</binding>

In my Java code, I do the following.

        List<Data> dataList = new ArrayList<Data>();
        DataResponse dataResponse = new DataResponse();
        dataResponse.setDataList(dataList);

The corresponding output is the following
....
  <datarequest>

<measures>RATES[curveId=178898;curveType=ZERO;offsetType=FWD;offset=1Y;f
requency=ANNUAL;basis=BASIS_30_360]-MATURITY-BSPLINE</measures>
    <periods>LATEST</periods>
    <latestdate>01-02-2010</latestdate>
    <requesteddate>23-12-2009</requesteddate>
  </datarequest>

  <datarequest>

<measures>RATES[curveId=178897;curveType=ZERO;offsetType=FWD;offset=0Y;f
requency=ANNUAL;basis=BASIS_30_360]-MATURITY-BSPLINE</measures>
    <periods>LATEST</periods>
    <latestdate>01-02-2010</latestdate>
    <requesteddate>23-12-2009</requesteddate>
  </datarequest>
....


As you see that dataList element does not appear. However, when I
properly populate dataList collection object, I see that element appearing  
after
marshalling. I am expecting an empty <dataList/> element when the object is
empty. What am I missing in the binding map ? Any help is highly
appreciated.

Thanks a lot



      
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to