title: Map Java Object to @XmlElement Value
body: <p>The LocationType Set coming null when I'm running JAXBxmlToJava. Can any body suggest how to map type component of xml to LocationType Object of Java.
  I have following arc-response.xml:-</p>
  
  <pre><code>&lt;address_component&gt;
     &lt;long_name&gt;BMC Colony&lt;/long_name&gt;
     &lt;short_name&gt;BMC Colony&lt;/short_name&gt;
     &lt;type&gt;neighborhood&lt;/type&gt;
     &lt;type&gt;political&lt;/type&gt;
    &lt;/address_component&gt;
  </code></pre>
  
  <p>And Following Code, AddressComponent:-</p>
  
  <pre><code>@XmlRootElement(name = "address_component")
  public class AddressComponent {
  
      @XmlElement(name = "long_name")
      private String longName;
      @XmlElement(name = "short_name")
      private String shortName;
      @XmlElement(name = "type")
      private Set&lt;LocationType&gt; locationTypeSet;
      //Setter Getter
  }
  </code></pre>
  
  <p>LocationType:-</p>
  
  <pre><code>@XmlRootElement(name="type")
  public class LocationType {
  
      private Integer locationTypeId;
      @XmlElement(name = "type")
      private String type;
      private String status;
      //Setter Getter
  }
  </code></pre>
  
  <p>JAXBxmlToJava.java:- </p>
  
  <pre><code>    public class JAXBxmlToJava {
      public static void main(String[] args) {
          try {
              File file = new File("arc-response.xml");
              JAXBContext jaxbContext = JAXBContext.newInstance(AddressComponent.class);
  
              Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
              AddressComponent geoResponse = (AddressComponent) jaxbUnmarshaller.unmarshal(file);
              System.out.println(geoResponse);
          } catch (JAXBException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>