title: How do I add array indices to the XML produced by JAXB?
body: <p>I have a Java bean ala</p>
  
  <pre><code>@XmlRootElement public class Bean {
      @XmlElementWrapper(name = "ints") @XmlElement(name = "int")
      int[] values;
  
      // constructors, getters, setters, etc...
  }
  </code></pre>
  
  <p>JAXB is producing XML like</p>
  
  <pre><code>&lt;bean&gt;
      &lt;ints&gt;
          &lt;int&gt;12&lt;/int&gt;
          &lt;int&gt;34&lt;/int&gt;
          &lt;int&gt;56&lt;/int&gt;
      &lt;/ints&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I would like the array indices to be included on the <code>&lt;int&gt;</code> tags as array position conveys important value. Preferably as attributes like </p>
  
  <pre><code>&lt;bean&gt;
      &lt;ints&gt;
          &lt;int id='0'&gt;12&lt;/int&gt;
          &lt;int id='1'&gt;34&lt;/int&gt;
          &lt;int id='2'&gt;56&lt;/int&gt;
      &lt;/ints&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Is there a way to do this?</p>