users@jaxb.java.net

Re: Specifying Interfaces that generated classes extend/implement

From: Marek Malowidzki <maom_onet_at_poczta.onet.pl>
Date: Thu, 06 Mar 2003 18:33:52 +0100

> On Thu, 6 Mar 2003 12:35:38 +0100, Marek Malowidzki <maom_onet_at_poczta.onet.pl>
wrote:
> >example, multiple XML elements have both 'width' and 'height' attributes.
From
> >the point of view of XML, these elements are completely separate, but in
>
> Why not make them an attributeGroup in the xsd? Wouldn't Java autogenerate
that common interface then?

My example is more complex:

 <xsd:complexType name="ColumnTemplate">
  <xsd:sequence>
   <xsd:group ref="EntryTemplate"/>
   <xsd:group ref="VariableValue"/>
  </xsd:sequence>
  <xsd:attributeGroup ref="ColumnExtAttributeGroup"/>
 </xsd:complexType>

 <xsd:complexType name="VariableTemplate">
  <xsd:sequence>
   <xsd:group ref="EntryTemplate"/>
   <xsd:group ref="VariableValue"/>
  </xsd:sequence>
  <xsd:attribute name="group" type="xsd:IDREF"/>
  <xsd:attribute name="rows" type="PositiveShort"/>
  <xsd:attribute name="max-access" type="MaxAccess"/>
  <xsd:attribute name="show" type="xsd:boolean" default="true"/>
 </xsd:complexType>

I would like both types to include all methods generated for the two groups of
elements and for one of attributes (which is also present in
ColumnExtAttributeGroup). Using pseudo-code, I would like my generated Java
classes to implement the following interface:

interface Common {
    EntryTemplate methods
    VariableValue methods
    attribute max-access
}

It was easy with early access release and now it is not possible. Another case
could be, as I already mentioned, when you get XML and cannot modify it.

Marek