title: JAXB substitution group marshals but will not unmarshal correctly
body: <p>I am implementing the OGC Web Feature Service and part of that is creating a feature schema that will inherit from the OGC schema. My service marshals the XML fine, but the client is unable to unmarshal the XML. I wrote a tester that illustrates the problem:</p>
  
  <pre><code>...
  ObjectFactory wfsfactory = new ObjectFactory();
  net.opengis.gml.v_3_1_1.ObjectFactory gmlfactory = new net.opengis.gml.v_3_1_1.ObjectFactory();
  com.example.ObjectFactory exampleFactory = new com.example.ObjectFactory();
  OgcJaxbManager manager = OgcJaxbManager.getInstance();
  FeatureCollectionType featureCollection = wfsfactory
          .createFeatureCollectionType();
  FeaturePropertyType prop = gmlfactory.createFeaturePropertyType();
  prop.setFeature(exampleFactory.createFoo(exampleFactory.createFoo()));
  featureCollection.setFeatureMember(Arrays.asList(prop));
  //marshal to XML
  String xml = manager.marshal(wfsfactory
          .createFeatureCollection(featureCollection));
  log.info(xml);
  //unmarshal back to object
  FeatureCollectionType afterMarshal = (FeatureCollectionType) manager
          .unmarshal(xml);
  JAXBElement&lt;? extends AbstractFeatureType&gt; feature = afterMarshal
          .getFeatureMember().get(0).getFeature();
  if (feature == null) {
      log.info("null");
  } else {
      log.info("not null");
  }
  ...
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;ns4:FeatureCollection xmlns:ns2="http://www.w3.org/1999/xlink" xmlns:ns1="http://www.opengis.net/gml" xmlns:ns4="http://www.opengis.net/wfs" xmlns:ns3="http://www.w3.org/2001/SMIL20/" xmlns:ns9="http://www.opengis.net/wms" xmlns:ns5="http://www.opengis.net/ows/1.1" xmlns:ns6="http://www.opengis.net/ogc" xmlns:ns10="http://example.com" xmlns:ns7="http://www.opengis.net/ows" xmlns:ns11="http://www.w3.org/2001/SMIL20/Language" xmlns:ns8="http://www.opengis.net/wcs/1.1.1"&gt;
      &lt;ns1:featureMember&gt;
          &lt;ns10:foo&gt;
              &lt;ns10:bar&gt;0&lt;/ns10:bar&gt;
          &lt;/ns10:foo&gt;
      &lt;/ns1:featureMember&gt;
  &lt;/ns4:FeatureCollection&gt;
  
  null
  </code></pre>
  
  <p>Here is the OGC schema I am extending:</p>
  
  <pre><code>...
      &lt;element name="FeatureCollection" type="gml:FeatureCollectionType" substitutionGroup="gml:_Feature"/&gt;
      &lt;!-- =========================================================== --&gt;
      &lt;complexType name="FeatureCollectionType"&gt;
          &lt;annotation&gt;
              &lt;documentation&gt;Concrete generic feature collection.&lt;/documentation&gt;
          &lt;/annotation&gt;
          &lt;complexContent&gt;
              &lt;extension base="gml:AbstractFeatureCollectionType"/&gt;
          &lt;/complexContent&gt;
      &lt;/complexType&gt;
      &lt;!-- ===========================================================   --&gt;
      &lt;complexType name="AbstractFeatureCollectionType" abstract="true"&gt;
          &lt;annotation&gt;
              &lt;documentation&gt;A feature collection contains zero or more features.&lt;/documentation&gt;
          &lt;/annotation&gt;
          &lt;complexContent&gt;
              &lt;extension base="gml:AbstractFeatureType"&gt;
                  &lt;sequence&gt;
                      &lt;element ref="gml:featureMember" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;element ref="gml:featureMembers" minOccurs="0"/&gt;
                  &lt;/sequence&gt;
              &lt;/extension&gt;
          &lt;/complexContent&gt;
      &lt;/complexType&gt;
      &lt;!-- ===== property for feature association ==== --&gt;
      &lt;element name="featureMember" type="gml:FeaturePropertyType"/&gt;
      &lt;!-- ============================================================== --&gt;
      &lt;complexType name="FeaturePropertyType"&gt;
          &lt;annotation&gt;
              &lt;documentation&gt;Container for a feature - follow gml:AssociationType pattern.&lt;/documentation&gt;
          &lt;/annotation&gt;
          &lt;sequence minOccurs="0"&gt;
              &lt;element ref="gml:_Feature"/&gt;
          &lt;/sequence&gt;
          &lt;attributeGroup ref="gml:AssociationAttributeGroup"/&gt;
      &lt;/complexType&gt;
      &lt;!-- ============================================================== --&gt;
      &lt;element name="_Feature" type="gml:AbstractFeatureType" abstract="true" substitutionGroup="gml:_GML"/&gt;
      &lt;!-- =========================================================== --&gt;
      &lt;complexType name="AbstractFeatureType" abstract="true"&gt;
          &lt;annotation&gt;
              &lt;documentation&gt;An abstract feature provides a set of common properties, including id, metaDataProperty, name and description inherited from AbstractGMLType, plus boundedBy.    A concrete feature type must derive from this type and specify additional  properties in an application schema. A feature must possess an identifying attribute ('id' - 'fid' has been deprecated).&lt;/documentation&gt;
          &lt;/annotation&gt;
          &lt;complexContent&gt;
              &lt;extension base="gml:AbstractGMLType"&gt;
                  &lt;sequence&gt;
                      &lt;element ref="gml:boundedBy" minOccurs="0"/&gt;
                      &lt;element ref="gml:location" minOccurs="0"&gt;
                          &lt;annotation&gt;
                              &lt;appinfo&gt;deprecated&lt;/appinfo&gt;
                              &lt;documentation&gt;deprecated in GML version 3.1&lt;/documentation&gt;
                          &lt;/annotation&gt;
                      &lt;/element&gt;
                      &lt;!-- additional properties must be specified in an application schema --&gt;
                  &lt;/sequence&gt;
              &lt;/extension&gt;
          &lt;/complexContent&gt;
      &lt;/complexType&gt;
  ...
  </code></pre>
  
  <p>Here is my schema:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;xsd:schema version="1.0" targetNamespace="http://example.com"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:example="http://example.com"
      xmlns:gml="http://www.opengis.net/gml"
      elementFormDefault="qualified"&gt;
  
      &lt;xsd:import namespace="http://www.opengis.net/gml"
          schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/&gt;
  
      &lt;xsd:element name="foo" type="example:foo"
          substitutionGroup="gml:_Feature"/&gt;
  
      &lt;xsd:complexType name="foo"&gt;
          &lt;xsd:complexContent&gt;
              &lt;xsd:extension base="gml:AbstractFeatureType"&gt;
                  &lt;xsd:sequence&gt;
                      &lt;xsd:element name="bar" type="xsd:string" minOccurs="0"/&gt;
                  &lt;/xsd:sequence&gt;
              &lt;/xsd:extension&gt;
          &lt;/xsd:complexContent&gt;
      &lt;/xsd:complexType&gt;
  
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>Here is the POJO that <code>xjc</code> produces:</p>
  
  <pre><code>package com.example;
  
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "foo", propOrder = { "bar" })
  public class Foo extends AbstractFeatureType {
  
      protected String bar;
  
      ...
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>