title: JAXB unmarshalling object in object
body: <p>I cant unmarshall xml because don't understand how to annotate object class in the another object. Please help.</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ODZ xmlns="http://www.company.com/1.0" &gt;
      &lt;Data DataID="ZZZ"&gt;
          &lt;UserData UserKey="user_001"&gt;
                   &lt;UserEvent&gt;...&lt;/UserEvent&gt;
              &lt;/UserData&gt; 
       &lt;/Data&gt;
  &lt;/ODZ&gt;
  </code></pre>
  
  <p>Container classes:
  I. First level with link to the second (<strong>ODZ -> Data</strong>).</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.NONE)
  @XmlRootElement(name = "ODZ", namespace = "http://www.company.com/1.0")
  public class ODZContainer {
  
      private ImportContainer importContainer;
  
      @XmlElement (name = "Data", type=ImportContainer.class)
      public ImportContainer getImportContainer() {
          return importContainer;
      }
  }
  </code></pre>
  
  <p>II. Second level with link to the third level(<strong>Data -> UserData</strong>).</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.NONE)
  @XmlRootElement(name = "Data")
  public class ImportContainer {
  
      private String DataID;
      private ArrayList&lt;UserDataBean&gt; userDataBean;
  
      @XmlElement (name = "UserData", type=UserDataBean.class)
      public ArrayList&lt;UserDataBean&gt; getUserDataBean() {
          return userDataBean;
      }
  
      @XmlAttribute(name = "DataID")
      public String getDataID() {
          return DataID;
      }
  }
  </code></pre>
  
  <p>III. Third level with link to the fourth level(<strong>UserData-> UserEvent</strong>).</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.NONE)
      @XmlRootElement(name = "UserData")
      public class UserDataBean {
          private ArrayList&lt;UserEventBean&gt; userEventData;
          private String userEventID;
  
          @XmlAttribute(name = "UserKey")
          public String getUserEventID() {
              return userEventID;
          }
  
          @XmlElement (name = "UserEvent", type=UserEventBean.class)
          public ArrayList&lt;UserEventBean&gt; getUserEventBean() {
              return userEventData;
          }
      }
  </code></pre>