users@jaxb.java.net

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

From: Malachi de Ælfweald <malachid_at_gmail.com>
Date: Tue, 7 Mar 2006 07:50:34 -0800

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
>
>