users@jaxb.java.net

Schema choice/sequence behavior changed from 1.0 to 2.0ea

From: Petteri Stenius <Petteri.Stenius_at_ubisecure.com>
Date: Tue, 7 Mar 2006 17:39:18 +0200

Hello,

The following sample schema produces very different Java interfaces with
JAXB 1.0 and 2.0ea3

<schema
    targetNamespace="urn:uuid:e4e858d8-4f1c-4582-8cbe-5412201b873b"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:my="urn:uuid:e4e858d8-4f1c-4582-8cbe-5412201b873b">
    
<complexType name="A1Type"/>
<complexType name="A2Type"/>
<complexType name="C1Type"/>

<element name="A1" type="my:A1Type"/>
<element name="A2" type="my:A2Type"/>
<element name="C1" type="my:C1Type"/>

<element name="E1" type="my:E1Type"/>
<complexType name="E1Type">
    <choice>
        <sequence>
            <choice>
                <element ref="my:A1"/>
                <element ref="my:A2"/>
            </choice>
            <element ref="my:C1" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
        <element ref="my:C1" maxOccurs="unbounded"/>
    </choice>
</complexType>

</schema>


With 1.0 the E1Type interface is quite nice with methods like these

List getC1()
A1Type getA1()
void setA1(A1Type value)
...

With 2.0 the E1Type interface is not what I would expect, with a single
"catch-all" property

List<JAXBElement<?>> getContent()


Has this behavior changed by design? What could I do with JAXB 2.0 to create
a more accessible interface for E1Type?


Best regards,
Petteri Stenius