users@jaxb.java.net

jaxb2 - duplicate element issue

From: Ajay Aggarwal <aaggarwal_at_covergence.com>
Date: Tue, 1 Apr 2008 13:38:10 -0400

We have a type in our schema, which looks like below. Our intent for
this type is to have at least one property element followed by any
combination of property or compound elements.

 

   <xsd:complexType name="foo">

        <xsd:sequence>

            <xsd:element name="property" type="typeA"/>

            <xsd:choice maxOccurs="unbounded">

                <xsd:element name="property" type="typeA"/>

                <xsd:element name="compound" type="typeB"/>

            </xsd:choice>

        </xsd:sequence>

    </xsd:complexType>

 

This was working fine with JAXB1 based xjc tool. But with JAXB2, it
gives following error. To the best of my knowledge, above is a valid
schema. Is this a limitation of JAXB2? Is there any other way to
formulate this schema to make JAXB2/xjc happy?

 

Errors from jaxb2 xjc ant task

      [xjc] Consider using <depends>/<produces> so that XJC won't do
unnecessary compilation

      [xjc] [ERROR] Element "property" shows up in more than one
properties.