You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by John Meagher <jo...@gmail.com> on 2007/03/29 19:23:55 UTC

Compile error with restricted attributes in an extension type

Using Axis 1.4 with the schema below the source code generated from
wsdl2java has a compile error.  The problem is that for the base type
Measure the attribute unit is handled by creating get/set methods that
use Strings.  For the derived type Angle the get/set methods for unit
are using AngleUnit instances which are not compatible with it's
parent class return type.

The question is can this be worked around?  The end result must be
compatible with the existing schema.  Either schema changes or
generation-time code modifications are possible.

Thanks,
John


Schema extract:

<xsd:complexType name="Measure" abstract="true">
  <xsd:simpleContent>
    <xsd:extension base="xsd:decimal">
      <xsd:attribute name="unit" type="xsd:string" use="optional" />
    </xsd:extension>
  </xsd:simpleContent>
</xsd:complexType>

<xsd:complexType name="Angle" abstract="true">
  <xsd:simpleContent>
    <xsd:restriction base="Measure">
      <xsd:minInclusive value="0" />
      <xsd:maxExclusive value="360" />
      <xsd:attribute name="unit" type="xsd:string" use="optional"
default="degrees">
        <xsd:simpleType>
          <xsd:restriction base="xsd:token">
            <xsd:enumeration value="degrees">
          </xsd:restriction>
    </xsd:extension>
  </xsd:simpleContent>
</xsd:complexType>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org