title: JAXB unmarshalling: child elements are null
body: <p>I am trying to unmarshal a XML document:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;map&gt;
     &lt;room id="1" name="Stairway" east="2"/&gt;
     &lt;room id="2" name="Kitchen" north="4" south="3" west="1"&gt;
         &lt;object name="Hat"/&gt;
     &lt;/room&gt;
     &lt;room id="3" name="Hallway" east="1" south="4"&gt;
         &lt;object name="Money"/&gt;
     &lt;/room&gt;
     &lt;room id="4" name="Bathroom" south="2"/&gt;
  &lt;/map&gt;
  </code></pre>
  
  <p>And the XSD schema (generated by some tool):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xsd:element name="map"&gt;
      &lt;xsd:complexType&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element minOccurs="1" maxOccurs="unbounded" name="room"&gt;
            &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                &lt;xsd:element minOccurs="0" maxOccurs="unbounded" name="object"&gt;
                  &lt;xsd:complexType&gt;
                    &lt;xsd:attribute name="name" type="xsd:string" /&gt;
                  &lt;/xsd:complexType&gt;
                &lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:attribute name="id" type="xsd:int" /&gt;
              &lt;xsd:attribute name="name" type="xsd:string" /&gt;
              &lt;xsd:attribute name="north" type="xsd:int" /&gt;
              &lt;xsd:attribute name="south" type="xsd:int" /&gt;
              &lt;xsd:attribute name="west" type="xsd:int" /&gt;
              &lt;xsd:attribute name="east" type="xsd:int" /&gt;
            &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
    &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>These are the important model classes:</p>
  
  <p>Map.java</p>
  
  <pre class="lang-java prettyprint-override"><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {"rooms"})
  @XmlRootElement(name = "map")
  public class Map {
  
      /**
       * List of rooms contained in this map.
       */
      @XmlElement(required = true)
      protected List&lt;Room&gt; rooms;
  
      /**
       * Gets the value of the rooms property.
       *
       * &lt;p&gt;
       * This accessor method returns a reference to the live list,
       * not a snapshot. Therefore any modification you make to the
       * returned list will be present inside the JAXB objects.
       * This is why there is not a &lt;CODE&gt;set&lt;/CODE&gt; method for the rooms property.
       *
       * &lt;p&gt;
       * For example, to add a new item, do as follows:
       * &lt;pre&gt;
       *    getRooms().add(newItem);
       * &lt;/pre&gt;
       *
       *
       * &lt;p&gt;
       * Objects of the following type(s) are allowed in the list
       * {@link Room }
       *
       *
       */
      public List&lt;Room&gt; getRooms() {
          if (rooms == null) {
              rooms = new ArrayList&lt;Room&gt;();
          }
          return this.rooms;
      }
  
  }
  </code></pre>
  
  <p>Room.java</p>
  
  <pre class="lang-java prettyprint-override"><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {
          "objects"
  })
  public class Room {
  
      @XmlElement(required = true)
      protected List&lt;Object&gt; objects;
      @XmlAttribute(name = "id")
      protected Integer id;
      @XmlAttribute(name = "name")
      protected String name;
      @XmlAttribute(name = "north")
      protected Integer north;
      @XmlAttribute(name = "south")
      protected Integer south;
      @XmlAttribute(name = "west")
      protected Integer west;
      @XmlAttribute(name = "east")
      protected Integer east;
  
      /**
       * Gets the value of the objects property.
       * 
       * &lt;p&gt;
       * This accessor method returns a reference to the live list,
       * not a snapshot. Therefore any modification you make to the
       * returned list will be present inside the JAXB objects.
       * This is why there is not a &lt;CODE&gt;set&lt;/CODE&gt; method for the objects property.
       * 
       * &lt;p&gt;
       * For example, to add a new item, do as follows:
       * &lt;pre&gt;
       *    getObjects().add(newItem);
       * &lt;/pre&gt;
       * 
       * 
       * &lt;p&gt;
       * Objects of the following type(s) are allowed in the list
       * {@link Object }
       * 
       * 
       */
      public List&lt;Object&gt; getObjects() {
          if (objects == null) {
              objects = new ArrayList&lt;Object&gt;();
          }
          return this.objects;
      }
  
      /**
       * Ruft den Wert der id-Eigenschaft ab.
       * 
       * @return
       *     possible objects is
       *     {@link Integer }
       *     
       */
      public Integer getId() {
          return id;
      }
  
      /**
       * Legt den Wert der id-Eigenschaft fest.
       * 
       * @param value
       *     allowed objects is
       *     {@link Integer }
       *     
       */
      public void setId(Integer value) {
          this.id = value;
      }
  
      /**
       * Ruft den Wert der name-Eigenschaft ab.
       * 
       * @return
       *     possible objects is
       *     {@link String }
       *     
       */
      public String getName() {
          return name;
      }
  
      /**
       * Legt den Wert der name-Eigenschaft fest.
       * 
       * @param value
       *     allowed objects is
       *     {@link String }
       *     
       */
      public void setName(String value) {
          this.name = value;
      }
  
      /**
       * Ruft den Wert der north-Eigenschaft ab.
       * 
       * @return
       *     possible objects is
       *     {@link Integer }
       *     
       */
      public Integer getNorth() {
          return north;
      }
  
      /**
       * Legt den Wert der north-Eigenschaft fest.
       * 
       * @param value
       *     allowed objects is
       *     {@link Integer }
       *     
       */
      public void setNorth(Integer value) {
          this.north = value;
      }
  
      /**
       * Ruft den Wert der south-Eigenschaft ab.
       * 
       * @return
       *     possible objects is
       *     {@link Integer }
       *     
       */
      public Integer getSouth() {
          return south;
      }
  
      /**
       * Legt den Wert der south-Eigenschaft fest.
       * 
       * @param value
       *     allowed objects is
       *     {@link Integer }
       *     
       */
      public void setSouth(Integer value) {
          this.south = value;
      }
  
      /**
       * Ruft den Wert der west-Eigenschaft ab.
       * 
       * @return
       *     possible objects is
       *     {@link Integer }
       *     
       */
      public Integer getWest() {
          return west;
      }
  
      /**
       * Legt den Wert der west-Eigenschaft fest.
       * 
       * @param value
       *     allowed objects is
       *     {@link Integer }
       *     
       */
      public void setWest(Integer value) {
          this.west = value;
      }
  
      /**
       * Ruft den Wert der east-Eigenschaft ab.
       * 
       * @return
       *     possible objects is
       *     {@link Integer }
       *     
       */
      public Integer getEast() {
          return east;
      }
  
      /**
       * Legt den Wert der east-Eigenschaft fest.
       * 
       * @param value
       *     allowed objects is
       *     {@link Integer }
       *     
       */
      public void setEast(Integer value) {
          this.east = value;
      }
  
  }
  </code></pre>
  
  <p>Now when I try to unmarshall that XML <code>map.rooms</code> is always null, there should be the list of rooms.</p>
  
  <p>Any idea what causes this and how to fix it? </p>