users@jaxb.java.net

Avoid marshalling empty elements

From: Abdullah Jibaly <amjibaly_at_yahoo.com>
Date: Fri, 30 Dec 2005 12:44:10 -0800 (PST)

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.
  
  Thanks,
  Abdullah