users@jaxb.java.net

JAXB complexType code generation problem

From: Jim Beard <beard_at_counterclaim.com>
Date: Tue, 17 Feb 2004 18:53:58 -0800

Howdy all,

        I work with a company that is trying to use JAX-B generated code in a
number of projects. The most recent one involves a rather complex set
of Schemas. In these Schemas there are complexTypes defined using
extension from other complexTypes. Some of these complexTypes are
based off of other complexTypes using restriction. XmlSpy validates
everything, as does a recent SAX parser. However xjc spits out errors
when I try to use JAX-B to generate code from the Schemas, and no code
is generated. The errors look like this:

[ERROR] Base complex type is derived by restriction, while this
complex type is derived by extension

        This problem occurs 5 or so times throughout the Schema. We have a
little bit of control over the Schema we are using ( though another
company is mainly responsible for it ). However we have no control
over the base Schemas that this Schema uses in its namespace.
        I tried running with '-extension' and adding in the
complexTypeSubstitution attributes, but still no luck. Does anyone
have any experience with this problem or any advice to offer?

        NOTE: I found a work around now by swapping the extension and
restriction elements of the complexTypes, so the that our base type
uses extensions and the final type is a restriction. This seems to
work. However, it is not an optimal solution due to the fact that it
changes the approach of what types of data elements are being defined
in which Schemas.

        I have been reviewing section 3.4.6 of the w3c Schema specifications
to see if this is a problem with our Schemas, or with JAXB. Anyone
have an opinion on this matter?

Jim Beard
counterclaim.com, Inc
http://www.counterclaim.com
http://openefm.sourceforge.net
(800) 264-8145


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