title: JAXB and inheritance in collection
body: <p>how can I map (via JAXB in java 1.6) Collection to XML and from XML, where</p>
  
  <pre><code>class mapping{
      @XmlElementWrapper(name="list")
      @XmlElement(name="item")
      Collection&lt;A&gt; list;
  }
  
  abstract class A{
  }
  
  class B extends A{
      public String onlyB;
  }
  
  class C extends A{
      public String onlyC;
  }
  </code></pre>
  
  <p>a would like to see XML like this:</p>
  
  <pre><code>&lt;something&gt; (doesnt matter, I'm using it in another structure)
  &lt;list&gt;
  &lt;item xsi:type="b"&gt;&lt;onlyB&gt;b&lt;/onlyB&gt;&lt;/item&gt;
  &lt;item xsi:type="c"&gt;&lt;onlyC&gt;c&lt;/onlyC&gt;&lt;/item&gt;
  &lt;/list&gt;
  &lt;/something&gt;
  </code></pre>
  
  <p>its working if I have</p>
  
  <pre><code>class mapping{        
      @XmlElement(name="item")
      A item;
  }
  </code></pre>
  
  <p>I already tried xmlelementref, but with no success</p>
  
  <p>and I dont want to use <code>@XmlElements({@XmlElement ...})</code> because other project which are using this can add derived class from A</p>