users@jaxb.java.net

RE: Schema choice/sequence behavior changed from 1.0 to 2.0ea

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

 
Ok. If I understand you correctly then my schema would look like this:
 
<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="E1" type="my:E1Type"/>
<complexType name="E1Type">
    <choice>
        <sequence>
            <choice>
                <element name="A1" type="my:A1Type"/>
                <element name="A2" type="my:A2Type"/>
            </choice>
            <element name="C1" type="my:C1Type" minOccurs="0"
maxOccurs="unbounded"/>
        </sequence>
        <element name="C1" type="my:C1Type" maxOccurs="unbounded"/>
    </choice>
</complexType>
</schema>
The interface of E1Type remains the same with this schema.
 
Thanks,
Petteri Stenius

  _____

From: Malachi de Ælfweald [mailto:malachid_at_gmail.com]
Sent: Tuesday, March 07, 2006 5:51 PM
To: users_at_jaxb.dev.java.net
Subject: Re: Schema choice/sequence behavior changed from 1.0 to 2.0ea


In general, each of my schemas only have one top-level <xsd:element/> which
happens to be the root of the document. Looking at your schema, it appears
you are saying that there might be more than one valid root tag... Can you
see what happens if you only have one top-level <xsd:element> and the rest
are complex types?
 
Malachi

 
On 3/7/06, Petteri Stenius <Petteri.Stenius_at_ubisecure.com> wrote:



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



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net