title: How to ignore elements/attributes in XML when mapping to objects using JAXB?
body: <p>I'm working with mapping XML strings into POJOs and viceversa using JAXB 2.0, and I want to be able to determine the elements in a XML that should be mapped into my annotated POJO classes.</p>
  
  <p>Let's say I have the following XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;customer id="1"&gt;
      &lt;firstName&gt;Peter&lt;/firstName&gt;
      &lt;lastName&gt;Parker&lt;/lastName&gt;
      &lt;socialSecurityNumber&gt;112233445566&lt;/socialSecurityNumber&gt;
  &lt;/customer&gt;
  </code></pre>
  
  <p>And I want to map it to a class that ommits the socialSecurityNumber element:</p>
  
  <pre><code>@XmlRootElement
  public class Customer {
      private Integer id;
      private String firstName;
      private String lastName;
  
      public Customer() {
      }
  
      public Customer(Integer id, String firstName, String lastName) {
          this.id = id;
          this.firstName = firstName;
          this.lastName = lastName;
      }
  
      @XmlAttribute
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      @XmlElement(nillable = true)
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      @XmlElement(nillable = true)
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  }
  </code></pre>
  
  <p>If I try to unmarshall this I get the error:</p>
  
  <blockquote>
    <p>unexpected element (uri:"", local:"socialSecurityNumber"). Expected elements are &lt;{}lastName></p>
  </blockquote>
  
  <p>Is it possible to ignore elements/attributes from a XML that aren't present in my POJO classes?</p>