users@jaxb.java.net

JAXBElement binding and the ObjectFactory

From: <mark_at_javector.com>
Date: Mon, 09 Jan 2006 10:28:56 -0700

Shouldn't the ObjectFactory createXXX methods return JAXBElement<T> instances
for local element declarations per 6.7.1 of the JAXB 2.0 specification?

However, when I run XJC on the following schema:

<schema targetNamespace="http://www.example.com/oms"
  elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
  xmlns:oms="http://www.example.com/oms">
  <element name="simpleOrder">
    <complexType>
      <sequence>
        <element name="billTo">
          <complexType>
            <sequence>
              <element name="street" type="string"/>
              <element name="city" type="string"/>
              <element name="state" type="string"/>
              <element name="zip" type="string"/>
              <element name="phone" type="string"/>
            </sequence>
          </complexType>
        </element>
        <element name="items">
          <complexType>
            <sequence>
              <element name="item" type="oms:ItemType" maxOccurs="unbounded"/>
            </sequence>
          </complexType>
        </element>
      </sequence>
    </complexType>
  </element>
  <complexType name="ItemType">
    <sequence>
      <element name="quantity" type="positiveInteger"/>
      <element name="price" type="double"/>
    </sequence>
    <attribute name="productName" use="required" type="string"/>
  </complexType>
</schema>

The ObjectFactory contains the following for the billTo element:

    /**
     * Create an instance of {_at_link BillTo }
     *
     */
    public BillTo createSimpleOrderBillTo() {
        return new BillTo();
    }

Shouldn't it return a JAXBElement<BillTo> ??


-- Mark