title: JAXB Unmarshalling having same XML elements and same attribute names but different attribute values into different Java objects
body: <p>I have the following xml that has the same XML element <code>&lt;child/&gt;</code> and also same attribute name &quot;action&quot; repeated multiple times (possibly repeated 1000 times in this xml) - I want to unmarshal this xml, using JAXB (annotations or customer adapter), into multiple Java objects based on the value of the attribute &quot;action&quot;.</p>
  <p>For e.g. For all the &quot;action&quot; attribute value &quot;Unchanged&quot;, I can map to List unchangedList object, for all the &quot;action&quot; attribute value &quot;New&quot; I would like to map to List newList and so on. Can we do that and how?</p>
  <pre><code>&lt;parent&gt;
     &lt;child name=&quot;John1&quot;  reason=&quot;12&quot; action=&quot;Unchanged&quot; /&gt;
     &lt;child name=&quot;John2&quot;  reason=&quot;12&quot; action=&quot;Unchanged&quot; /&gt;
     &lt;child name=&quot;John3&quot;  reason=&quot;12&quot; action=&quot;New&quot; /&gt;
     &lt;child name=&quot;John4&quot;  reason=&quot;12&quot; action=&quot;New&quot; /&gt;
     &lt;child name=&quot;John5&quot;  reason=&quot;12&quot; action=&quot;Delete&quot; /&gt;
     &lt;child name=&quot;John6&quot;  reason=&quot;12&quot; action=&quot;Delete&quot; /&gt;
     &lt;child name=&quot;John8&quot;  reason=&quot;12&quot; action=&quot;Unchanged&quot; /&gt;
     &lt;child name=&quot;John9&quot;  reason=&quot;12&quot; action=&quot;Delete&quot; /&gt;
     &lt;child name=&quot;John10&quot; reason=&quot;12&quot; action=&quot;New&quot; /&gt;
  &lt;/parent&gt;
  </code></pre>