title: JAXB - unmarshalled fields are null
body: <p>We are unmarshalling a response from <a href="http://xmlgw.companieshouse.gov.uk/" rel="noreferrer">http://xmlgw.companieshouse.gov.uk/</a>. This is the text sent to the marshall:</p>
  
  <pre><code>&lt;NameSearch xmlns="http://xmlgw.companieshouse.gov.uk/v1-0/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlgw.companieshouse.gov.uk/v1-0/schema http://xmlgw.companieshouse.gov.uk/v1-0/schema/NameSearch.xsd"&gt;
    &lt;ContinuationKey&gt;...&lt;/ContinuationKey&gt;
    &lt;RegressionKey&gt;...&lt;/RegressionKey&gt;
    &lt;SearchRows&gt;20&lt;/SearchRows&gt;
    &lt;CoSearchItem&gt;
      &lt;CompanyName&gt;COMPANY NAME&lt;/CompanyName&gt;
      &lt;CompanyNumber&gt;23546457&lt;/CompanyNumber&gt;
      &lt;DataSet&gt;LIVE&lt;/DataSet&gt;
      &lt;CompanyIndexStatus&gt;DISSOLVED&lt;/CompanyIndexStatus&gt;
      &lt;CompanyDate&gt;&lt;/CompanyDate&gt;
    &lt;/CoSearchItem&gt;
    // more CoSearchItem elements
  &lt;/NameSearch&gt;
  </code></pre>
  
  <p>The model of CoSearchItem is like this:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "CoSearchItem", propOrder = {
      "companyName",
      "companyNumber",
      "dataSet",
      "companyIndexStatus",
      "companyDate",
      "searchMatch"
  })
  public class CoSearchItem {
  
      @XmlElement(name = "CompanyName", required = true)
      protected String companyName;
      @XmlElement(name = "CompanyNumber", required = true)
      protected String companyNumber;
      @XmlElement(name = "DataSet", required = true)
      protected String dataSet;
      @XmlElement(name = "CompanyIndexStatus")
      protected String companyIndexStatus;
      @XmlElement(name = "CompanyDate")
      @XmlSchemaType(name = "date")
      protected XMLGregorianCalendar companyDate;
      @XmlElement(name = "SearchMatch")
      protected String searchMatch;
  
      // getters and setters
  
  }
  </code></pre>
  
  <p>NameSearch model has this structure:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "NameSearch", namespace = "http://xmlgw.companieshouse.gov.uk/v1-0/schema", propOrder = {
      "continuationKey",
      "regressionKey",
      "searchRows",
      "coSearchItem"
  })
  @XmlRootElement(name = "NameSearch", namespace = "http://xmlgw.companieshouse.gov.uk/v1-0/schema")
  public class NameSearch {
  
      @XmlElement(name = "ContinuationKey", required = true)
      protected String continuationKey;
      @XmlElement(name = "RegressionKey", required = true)
      protected String regressionKey;
      @XmlElement(name = "SearchRows", required = true)
      protected BigInteger searchRows;
      @XmlElement(name = "CoSearchItem")
      protected List&lt;CoSearchItem&gt; coSearchItem;
  
      // setters and getters
  
  }
  </code></pre>
  
  <p>The package has this annotations:</p>
  
  <pre><code>@XmlSchema(namespace = "http://xmlgw.companieshouse.gov.uk/v1-0", elementFormDefault = XmlNsForm.QUALIFIED, //
      xmlns = {
          @XmlNs(prefix = "xsi", namespaceURI = "http://www.w3.org/2001/XMLSchema-instance") 
       }
  )
  
  package uk.gov.companieshouse;
  </code></pre>
  
  <p>The unmarshaling is done from the first <code>Node</code> extracted from a larger <code>Document</code>, inside an <code>any</code> list of items. When we parse the xml however all the fields in CoSearchItem are set to null and can't figure out the reason.</p>