Normally, for the XMLElement, you would add the nillable=true attribute to @XmlElement. That would write out the element with a xsi:nil=true attribute.
Dan On Wed December 2 2009 10:50:12 pm Mustafa Sezgin wrote: > Hi all, > > > > I have some beans in a rest service which marshalled and sent back to the > end user. However sometimes certain fields in the bean may not have values > and as a result, the XML that gets produced can sometimes omit these > fields. We want the responses to always be consistent, so even if a field > does not have a value, then an empty tag should be returned. Looking at > the XMLElement and XMLAttribute annotations, there doesn't seem to be > anything which helps with this. I don't want to have to go back and > manually set an empty string value to these fields. And some of these > fields are Date or Integer objects so I cant set an empty value to these > fields, like I can with a string. > > Any ideas on how to get around this problem would be appreciated.. > > > > Thanks > -- Daniel Kulp [email protected] http://www.dankulp.com/blog
