Details
Description
When marshalling the HearingDetailsVO, I only set value for <applicationNo> field of HearingDetailsVO class. In the mapping file, all the fields are optional by setting /mapping/class/field/@required="false".
However, the retNode after marshalling contains null elements like <NOA/><caseNo/><designation/>, etc.
In the attachment file, the CISClient3.java contains the method testCIS();
the CISClient3Test.java is the JUnit test script;
The HearingDetailsVO.xml is the mapping file;
and the HearingDetailsVO.java is the domain entity.
Hi, just found the reason why you are seeing empty elements being generated as part of marshalling. In the constructor of your domain entity, you are assigned an empty string ("") to almost all of the members. This will basically prevent Castor from telling that a value has not been assigned to a member yet. Castor internally uses 'null's for such checks.
I have just commented out that code in question., and the XML produced by Castor after doing so meets your expected output.