W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

SOAP and WSDL and inheritance by restriction

From: James Pasley <james.pasley@capeclear.com>
Date: Tue, 11 Dec 2001 13:27:43 -0000
To: <xmlschema-dev@w3.org>
Message-ID: <001101c18247$9dfcbdc0$9400a8c0@REXX>

Apologies in advance for taking a long time to get to the question :)

The SOAP specification defines an XML representation of an Array using the
following definitions:

  <xs:group name="Array">
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"
processContents="lax" />

  <xs:complexType name="Array">
    <xs:group ref="tns:Array" minOccurs="0" />
    <xs:attributeGroup ref="tns:arrayAttributes" />
     <xs:attributeGroup ref="tns:commonAttributes" />

The full schema is available at: http://schemas.xmlsoap.org/soap/encoding/
As you can see, an Array is essentially a complex type containing a
unbounded number of xs:any's.

Typically, when you define arrays you inherit from this definition and
restrict the xs:any's in it to the particular of type in your array, so from
my reading of the inheritance rules, an array of floats should look as

<xs:complexType name="ArrayOfFloat">
    <xs:restriction base="soapenc:Array">
        <xs:element name="item" minOccurs="0" maxOccurs="unbounded"
type="xs:float" />
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xs:float[]"/>

However, the WSDL specification ( http://www.w3.org/TR/wsdl ) contains the
following example of an array of floats:

<complexType name="ArrayOfFloat">
    <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:float[]"/>

Now the Schema Primer states the following:

    Notice that types derived by restriction must repeat all
    the components of the base type definition that are to be
    included in the derived type

So (and here's the question), is the example from the WSDL specification
incorrect as it neither repeats the xs:any or replaces it with a more
restrictive element. Am I right in thinking that it actually defines an
complex type which can not contain child elements at all?



Cape Clear Software Limited.
61 Fitzwilliam Lane
Dublin 2

Email : james.pasley@capeclear.com
Switchboard  : + 353 (1) 2419900
Direct line  : + 353 (1) 2419957
Fax          : + 353 (1) 2419901
www          : www.capeclear.com

Visit www.capescience.com
Received on Tuesday, 11 December 2001 08:24:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:56 UTC