title: How to map XML elements and attributes via JAXB annotations?
body: <p>How does one map fields in JAXB annotations to elements and attributes? I'm having a bit of trouble trying to custom-tailor my model in JAXB. Here's my current model:</p>
  
  <p><strong>Info.java</strong>:</p>
  
  <pre><code>package com.rest.model;
  
  public class Info {
  
      private String a;
  
      private String b;
  
      private String c;
  
      private String d;
  
      public Info() {
  
      }
  
      /* ... insert JavaBean getters/setters here */
  }
  </code></pre>
  
  <p><strong>InfoList.java</strong>:</p>
  
  <pre><code>package com.rest.model;
  
  public class InfoList {
  
      private List&lt;Info&gt; infos;
  
      public InfoList() {
  
      }
  
      /* ... insert JavaBean getters/setters here */
  }
  </code></pre>
  
  <p>What this gets serialized to is the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;infos&gt;
      &lt;info&gt;
          &lt;a&gt;HELLO&lt;/a&gt;
          &lt;b&gt;WORLD&lt;/b&gt;
          &lt;c&gt;OLLEH&lt;/c&gt;
          &lt;d&gt;DLROW&lt;/d&gt;
      &lt;/info&gt;
  &lt;/streams&gt;
  </code></pre>
  
  <p>How can I control the way this is serialized? I have tried using annotations, but I only managed to trigger <code>IllegalAnnotationException</code>s. How would I essentially take this model as it is automatically mapped and express that in annotations? Alternatively, how can I change the fields in the <code>Info</code> class to be mapped to XML attributes instead?</p>