users@jaxb.java.net

Possible inconsistency in the way treatRestrictionLikeNewType behaves

From: Lucas Madar <lucas_at_mcsnw.com>
Date: Fri, 26 Jun 2009 14:57:21 -0700

Hello,

I have a class hierarchy that's generated like this (without the
treatRestrictionLikeNewType set):

class BaseEntity
class BaseSeries extends BaseEntity
class MeasurementSeries extends BaseSeries

In xsd, BaseSeries is an extension on BaseEntity, and MeasurementSeries
is a restriction on BaseEntity.

With treatRestrictionLikeNewType set, I would expect to get
MeasurementSeries extends BaseEntity, since it's not really involved in
the restriction, but instead I get an isolated class. It's unfortunate
that there's no clean way to do this in xsd that translates nicely into
java.

Here's an xsd snippet:

<xs:complexType name="baseEntity" abstract="true">
<xs:sequence>
<xs:element ref="identifier" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="baseSeries" abstract="true">
<xs:complexContent>
<xs:extension base="baseEntity">
<xs:sequence>
<xs:element ref="measuringDate" minOccurs="0" maxOccurs="1"/>
<xs:element ref="derivationDate" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:element name="measurementSeries">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="baseSeries">
<xs:sequence>
<xs:element ref="identifier" minOccurs="0"/>
<xs:element ref="measuringDate" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>

Thanks,
Lucas