title: Parse same XML tag to different java objects
body: <p>I am trying to parse below xml into java objects</p>
  <pre><code>&lt;MyCar&gt;
      &lt;Object name=&quot;Car's Front&quot; type=&quot;CarFront&quot;&gt;
          &lt;Object name=&quot;Car's Bumper&quot; type=&quot;Bumper&quot;&gt;&lt;/Object&gt;
          &lt;Object name=&quot;Car's Headlight&quot; type=&quot;Headlight&quot;&gt;&lt;/Object&gt;
          &lt;Object name=&quot;Car's Windshield&quot; type=&quot;Windshield&quot;&gt;&lt;/Object&gt;
      &lt;/Object&gt;
  &lt;/MyCar&gt;
  </code></pre>
  <p>Java Code</p>
  <pre><code>import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonTypeInfo;
  import com.fasterxml.jackson.dataformat.xml.XmlMapper;
  
  public class MyCarParser {
  
      public static void main(String[] args) throws Exception {
          XmlMapper xmlMapper = new XmlMapper();
          xmlMapper.readValue(new File(&quot;car.xml&quot;), MyCar.class);
      }
  }
  
  class MyCar {
      public String version;
  
      @JsonProperty(&quot;Object&quot;)
      public CarFront carFront; // This works
  }
  
  @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = &quot;type&quot;)
  abstract class CarObjects {
      public String name;
  }
  
  class CarFront extends CarObjects {
  
      // ???
      public Bumper bumper;
      public Headlight headlight;
      public Windshield windshield;
  }
  
  class Bumper extends CarObjects {}
  class Headlight extends CarObjects {}
  class Windshield extends CarObjects {}
  </code></pre>
  <p>Any suggestions on what annotations/extensions I should use so that I can serialise/deserialize this XML correctly to my desired Java objects structure.</p>