title: How to avoid serializing zero values with Simple Xml
body: <p>I'm trying to serialise an object using simple xml (http://simple.sourceforge.net/). The object setup is pretty simple:</p>
  
  <pre><code>@Root(name = "order_history")
  public class OrderHistory {
  
      @Element(name = "id", required = false)
      public int ID;
  
      @Element(name = "id_order_state")
      public int StateID;
  
      @Element(name = "id_order")
      public int OrderID;
  }
  </code></pre>
  
  <p>The problem is when I create a new instance of this class without an ID:</p>
  
  <pre><code>OrderHistory newhistory = new OrderHistory();
  newhistory.OrderID = _orderid;
  newhistory.StateID = _stateid;
  </code></pre>
  
  <p>and I serialize it via simple xml:</p>
  
  <pre><code>StringWriter xml = new StringWriter();
  Serializer serializer = new Persister();
  serializer.write(newhistory, xml);
  </code></pre>
  
  <p>it still reads 0 in the resulting xml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;order_history&gt;
      &lt;id&gt;0&lt;/id&gt;
      &lt;id_order&gt;2&lt;/id_order&gt;
      &lt;id_order_state&gt;8&lt;/id_order_state&gt;
  &lt;/order_history&gt;
  </code></pre>
  
  <p>I'm guessing the reason for this is that the ID property is not null, since integers can't be null. But I really need to get rid of this node, and I'd rather not remove it manually.</p>
  
  <p>Any clues anyone?</p>