title: JAXB Unmarshalling @XmlAnyElement
body: <p>I have created three JAXB class : <code>Home , Person , Animal</code> . Java Class 
  Home have variable <code>List&lt;Object&gt; any</code> that may contain Person and/or Animal instance .</p>
  
  <pre><code>    public class Home {
          @XmlAnyElement(lax = true)
          protected List&lt;Object&gt; any;
      //setter getter also implemented
      }
  @XmlRootElement(name = "Person")                            // Edited
      public class Person {
          protected String name; //setter getter also implemented
       } 
  @XmlRootElement(name = "Animal")                             // Edited
      public class Animal {
         protected String name; //setter getter also implemented
       }
  </code></pre>
  
  <hr>
  
  <p>/* <strong>After Unmarshalling</strong> */</p>
  
  <pre><code> Home home ;
  
                  for(Object obj : home .getAny()){
                      if(obj instanceof Person ){
                          Person  person = (Person )obj;
                          // .........
                      }else if(obj instanceof Animal ){
                          Animal animal = (Animal )obj;
                          // .........
                      }
                  }
  </code></pre>
  
  <p>I need to achieve <code>Person or Animal</code> object saved in <code>"Home.any" List</code> variable but content of <code>"Home.any" List</code> is instance of <code>com.sun.org.apache.xerces.internal.dom.ElementNSImpl</code> instead of <code>Animal or Person</code> .</p>
  
  <p>So is there a way to achieve <code>Animal or Person</code> instance that is saved in xml in <code>"Home.any" List</code>.</p>