Stack Exchange
Fairly simple XSD generating ObjectFactory wrapping root element class in JAXBElement
I'm struggling to understand why XJC is generating an ObjectFactory that wraps instances of the class corresponding to the root element in a JAXBElement wrapper.
The root element does not use an anonymous complex type.  (You have to be a little careful when reviewing this schema because there are pairs of complexType names that at first glance look the same, but one is plural and the other  singular -- e.g. optionalParametersType and optionalParameterType)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="urn:com-mbm-parameters"
           targetNamespace="urn:com-mbm-parameters"
           elementFormDefault="qualified"
           jaxb:version="2.0">
  <xs:element name="parameters" type="parametersType" />

  <xs:complexType name="parametersType">
    <xs:sequence>
      <xs:element name="option-parameters"              type="optionParametersType"             minOccurs="0" maxOccurs="1"/>
      <xs:element name="positional-parameters"          type="positionalParametersType"         minOccurs="0" maxOccurs="1"/>
      <xs:element name="mutually-exclusive-parameters"  type="mutuallyExclusiveParametersType"  minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="properties-file" type="xs:string" use="optional"/> 
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="optionParametersType">
   <xs:sequence>
      <xs:element name="option-parameter" type="optionParameterType" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="optionParameterType">
     <xs:sequence>
       <xs:element name="description" type="descriptionType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="type" type="xs:string" use="required"/>
    <xs:attribute name="id" type="xs:string" use="required"/>
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="command-line-name" type="xs:string" use="optional"/>
    <xs:attribute name="default-value" type="xs:string" use="optional"/>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="positionalParametersType">
    <xs:sequence>
      <xs:element name="positional-parameter" type="positionalParameterType" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="positionalParameterType">
    <xs:sequence>
      <xs:element name="description" type="descriptionType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="type" type="xs:string" use="required"/>
    <xs:attribute name="id" type="xs:string" use="required"/>
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="descriptionType">
     <xs:attribute name="forValue" type="xs:string" use="required"/>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="mutuallyExclusiveParametersType">
    <xs:sequence>
      <xs:element name="mutually-exclusive-parameter-set" type="mutuallyExclusiveParameterSetType" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="mutuallyExclusiveParameterSetType">
    <xs:sequence>
      <xs:element name="mutually-exclusive-parameter" type="mutuallyExclusiveParameterType" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <!--

  -->
  <xs:complexType name="mutuallyExclusiveParameterType">
    <xs:attribute name="id" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>
</xs:schema>

Here's the snippet of ObjectFactory that returns instances of the ParametersType class:
/**
     * Create an instance of {@link JAXBElement }{@code <}{@link ParametersType }{@code >}}
     * 
     */
    @XmlElementDecl(namespace = "urn:com-mbm-parameters", name = "parameters")
    public JAXBElement<ParametersType> createParameters(ParametersType value) {
        return new JAXBElement<ParametersType>(_Parameters_QNAME, ParametersType.class, null, value);
    }

This is the only place the JAXBElement is used within the entire ObjectFactory, so it's not there to disambiguate two or more possible elements.
Any idea why this is happening and how to remove the need to use the wrapper? 

You get JAXBElement for top-level elements, which, in this case, is your parameters element.
The rationale is to separate types and elements (which you can see as instances of types). So it is, actually, to disambiguate two or more possible elements - you may have another schema which has a different element of the same parametersType. Global elements are sometimes references via <xs:element ref="..."/>, they can have substitution groups etc., so in general always have JAXBElements for global elements is not completely unreasonable. I'm not saying it is the best design decision, I'm just saying there is some rationale in it.
To get rid of the wrapper, try using xjc:simple or adding @XmlRootElement annotation on your own:

https://stackoverflow.com/a/39778670/303810
JAXB xjc:simple binding does not generate @XmlRootElement for base class

But better don't fight it, embrace it.
