users@jaxb.java.net

RE: Re: Element children of same type but different names

From: Ajay Aggarwal <aaggarwal_at_covergence.com>
Date: Fri, 4 Apr 2008 09:09:45 -0400

That's what I was hoping. But what I get is instead:

 

        public List<JAXBElement<?>> getTypesOrConfigOrStatus()

________________________________

From: Mohit Anchlia [mailto:mohitanchlia_at_gmail.com]
Sent: Thursday, April 03, 2008 12:38 PM
To: users_at_jaxb.dev.java.net
Subject: Re: Element children of same type but different names

 

You should get methods like gettypes, getconfig, getstatus in class
myType after you compile the schema using xjc.sh . I think bindings are
useful when you want to override default binding for specific
implementation that JAXB internally uses. Anyone - correct me if I am
wrong.

On 4/3/08, Ajay Aggarwal <aaggarwal_at_covergence.com> wrote:

Using JAXB2.0 generated classes, is it possible to differentiate between
these children using generated types etc.? Are there any specific
binding customizations to deal with this situation? Below is an example
of the schema fragment:

 

         <xsd:complexType name="myType">

        <xsd:sequence>

            <xsd:choice maxOccurs="unbounded">

                <xsd:element name="types" type="myClassType"/>

                <xsd:element name="config" type="myClassType"/>

                <xsd:element name="status" type="myClassType"/>

            </xsd:choice>

        </xsd:sequence>

    </xsd:complexType>

 

Or is my only option is to use element's name to differentiate between
them? For example when I unmarshal and get an instance of JAXBElement,
how do I know if it's a "types", or "config" or "status" element?

 

Thanks.