users@jaxb.java.net

More JAXBElement

From: Brian Pontarelli <brian_at_pontarelli.com>
Date: Sun, 13 Feb 2005 06:56:02 -0600

I'm having another JAXBElement problem with JAXB 2.0. I'm wondering if
this is caused by the same bug that I emailed out before. This time it
looks like the ObjectFactory is returning JAXBElement whenever a complex
type is inherited. Here's my schema:

base-request.xsd
----------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
  <xs:complexType name="request" mixed="false"/>
</xs:schema>


some-request.xsd
----------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
  <xs:include schemaLocation="base-request-1.0.xsd"/>
  <xs:element name="someRequest">
    <xs:complexType mixed="false">
      <xs:complexContent>
        <xs:extension base="request">
          <xs:sequence>
            <xs:element name="foo" type="xs:string"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
</xs:schema>

I also thought at first it might be because my base type was empty. I
tried adding an element to the base type and the same thing occurred.
The ObjectFactory methods look like this:

    /**
     * Create an instance of {_at_link com.inversoft.SomeRequest}
     *
     */
    public com.inversoft.SomeRequest createSomeRequest() {
        return new com.inversoft.SomeRequest();
    }

    /**
     * Create an instance of {_at_link
javax.xml.bind.JAXBElement<com.inversoft.SomeRequest>}
     *
     */
    @javax.xml.bind.annotation.XmlElementDecl(name = "someRequest",
namespace = "")
    public javax.xml.bind.JAXBElement<com.inversoft.SomeRequest>
createSomeRequest(com.inversoft.SomeRequest value) {
        return new
javax.xml.bind.JAXBElement<com.inversoft.SomeRequest>(_SomeRequest_QNAME,
((java.lang.Class) com.inversoft.SomeRequest.class), null, value);
    }

Let me know if it is in fact a bug and if it is, if there are any
work-arounds until the next release is out.

Thanks,
- brian