users@jaxb.java.net

Re: Avoid marshalling empty elements

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Fri, 06 Jan 2006 10:39:54 -0800

Abdullah Jibaly wrote:
> Hi all,
>
> How do I avoid generating an emtpy element if it's value is null:
>
> @XmlRootElement
> public class Root {
> public String element1;
> public String element2;
> }
>
> This gives me <element1></element1> and <element2></element2> if they are null, I do not want them at all though...
>
> Any help would be appreciated.

If it's really showing up as that, this would be a serious bug. I run
some quick test with the code and it seems working just fine for me.

Try the latest bits, perhaps EA3. Also makes sure you aren't having
empty strings "" in those fields.

If you still suspect that this is a real problem, please file a bug to
issue tracker with a test case.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com