title: Unmarshalling unexpected element error
body: <p>I have a very similar problem to this topic <a href="https://stackoverflow.com/questions/14519902/unexpected-element-error-while-unmarshalling">unexpected element error while unmarshalling</a>, but still I am not able to solve the exception. As the namespace in XML and package-info is exactly the same... or is it because of the xsd file ?</p>
  
  <pre><code>Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.example.org/Uni", local:"Uni"). Expected elements are &lt;{http://www.example.org/Uni}uni&gt;
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;tns:Uni xmlns:tns="http://www.example.org/Uni" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/Uni Uni.xsd "&gt;
    &lt;tns:Semester&gt;
      &lt;tns:nr&gt;1&lt;/tns:nr&gt;
      &lt;tns:datum&gt;01.02.2012&lt;/tns:datum&gt;
    &lt;/tns:Semester&gt;
     &lt;tns:Semester&gt;
      &lt;tns:nr&gt;2&lt;/tns:nr&gt;
      &lt;tns:datum&gt;01.02.2012&lt;/tns:datum&gt;
    &lt;/tns:Semester&gt;
  &lt;/tns:Uni&gt;
  </code></pre>
  
  <p>XSD</p>
  
  <p>
  
  
      </p>
  
  <pre><code>&lt;complexType name="Uni"&gt;
      &lt;choice&gt;
          &lt;element name="Semester" type="tns:Semester" maxOccurs="unbounded"&gt;&lt;/element&gt;
      &lt;/choice&gt;
  &lt;/complexType&gt;
  
  &lt;complexType name="Semester"&gt;
      &lt;sequence&gt;
          &lt;element name="nr" type="int"&gt;&lt;/element&gt;
          &lt;element name="datum" type="string"&gt;&lt;/element&gt;
      &lt;/sequence&gt;
  &lt;/complexType&gt;
  </code></pre>
  
  <p></p>
  
  <p>package-info</p>
  
  <pre><code>@javax.xml.bind.annotation.XmlSchema(
          namespace = "http://www.example.org/Uni", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
  package parserTest;
  </code></pre>
  
  <p>Uni.java</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlRootElement
  public class Uni
  {
  
      @XmlElement(name = "Semester")
      protected List&lt;Semester&gt;    semester;
  
      public List&lt;Semester&gt; getSemester()
      {
          if (this.semester == null)
          {
              this.semester = new ArrayList&lt;Semester&gt;();
          }
          return this.semester;
      }
  
  }
  </code></pre>
  
  <p>Unmarshalling</p>
  
  <pre><code>public static void main(String[] args) throws JAXBException
  {
      ObjectFactory factoryForElementObjects = new ObjectFactory();
      List&lt;Semester&gt; semesterL = new ArrayList&lt;Semester&gt;();
  
      Uni uni = new Uni();
      uni.semester = semesterL;
  
      JAXBContext context = JAXBContext.newInstance(Uni.class);
      Unmarshaller unmarshaller = context.createUnmarshaller();
      Uni un = (Uni) unmarshaller.unmarshal(new File("src/main/resources/Uni.xml"));
      List&lt;Semester&gt; semesterA = un.semester;
      System.out.println(semesterA.get(0).nr);
  }
  </code></pre>