title: Generating closing tag for empty elements using XMLBeans
body: <p>I have following xsd :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="employee" type="employeeType"/&gt;
    &lt;xs:complexType name="employeeType"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element type="xs:string" name="name"/&gt;
        &lt;xs:element type="xs:int"  name="age"/&gt; 
        &lt;xs:element type="xs:string" name="address"/&gt;          
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>If i set value <strong>only</strong> for Name i.e    </p>
  
  <pre><code> EmployeeDocument request=EmployeeDocument.Factory.newInstance();
   EmployeeType emp=EmployeeType.Factory.newInstance();
   emp.setName("Name");
   request.setEmployee(emp);
  </code></pre>
  
  <p>Then XMLBeans generating following xml:</p>
  
  <pre><code>&lt;employee&gt;
      &lt;name&gt;Name&lt;/name&gt;
  &lt;/employee&gt;
  </code></pre>
  
  <p>But i need a following kind of xml to be generated ,means closing tags <code>&lt;/&gt;</code> for all elements whose values are not set in program :</p>
  
  <pre><code>&lt;employee&gt;
      &lt;name&gt;Name&lt;/name&gt;
      &lt;age/&gt;
      &lt;address/&gt;
  &lt;/employee&gt;
  </code></pre>
  
  <p>well , XMLBeans generating <code>&lt;address/&gt;</code> if i set an empty string i.e <code>emp.setAddress("");</code></p>
  
  <p>Is there any way we could meet such requirement using XMLBeans , without setting empty string.</p>
  
  <p>And more over we could not set empty string for element age which is of type int .</p>
  
  <p>Any help would be appreciated.</p>