title: JAXB Marshalling with null fields
body: <p>This is a pretty simple request, but I just didn't find a way to do it.</p>
  
  <p>I'm basically trying to set up a role in JAXB which says that whenever an null field is encountered, instead of ignoring it in the output, set it to an empty value. So for the class :</p>
  
  <pre><code>@XMLRootElement
  Class Foo {
     Integer num;
     Date date;
  ….
  }
  </code></pre>
  
  <p>When this has been marshalled into the XML file if the date field is null, my output does not have that element in it. What I want to do is include all the fields in the output; and if they are null, replace them with -  say a blank. So the output should be :</p>
  
  <pre><code>&lt;foo&gt;
    &lt;num&gt;123&lt;/num&gt;
    &lt;date&gt;&lt;/date&gt;
  &lt;/foo&gt;
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Jalpesh.</p>