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

Re: Complex type inheritance is evil!

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 07 Jun 2001 13:06:38 +0100
To: "Anderson, John" <John@Barbadosoft.com>
Cc: "'K.Kawaguchi '" <kohsukekawaguchi@yahoo.com>, "'xml-dev@lists.xml.org '" <xml-dev@lists.xml.org>, "'Eddie Robertsson '" <eddie@allette.com.au>, xmlschema-dev@w3.org
Message-ID: <f5b1yowbik1.fsf@cogsci.ed.ac.uk>
Sorry for tardy reply.

The complex type below cannot be validly restricted, because of the
anonymous simple type in the definition of the <quantity> element.  I
agree this is a pain.  There is no difference in the REC in the
treatment of the types of attributes and the types of elements in this 
regard.  The 'shipBy' attribute also cannot be restricted, but it
could take part in a valid restriction by not being mentioned at all.
This attribute/element asymmetry is _not_ the one you appear to
believe is the source of your problem.

"Anderson, John" <John@Barbadosoft.com> writes:

> <xsd:complexType name="Items"> 
>   <xsd:sequence> 
>    <xsd:element name="item" minOccurs="0" maxOccurs="unbounded"> 
>     <xsd:complexType> 
>      <xsd:sequence> 
>       <xsd:element name="productName" type="xsd:string"/> 
>       <xsd:element name="quantity"> 
>        <xsd:simpleType> 
>         <xsd:restriction base="xsd:positiveInteger"> 
>          <xsd:maxExclusive value="100"/> 
>         </xsd:restriction> 
>        </xsd:simpleType> 
>       </xsd:element> 
>       <xsd:element name="USPrice"  type="xsd:decimal"/> 
>       <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/> 
>      </xsd:sequence> 
>     </xsd:complexType> 
>    </xsd:element> 
>   </xsd:sequence> 
>   <xsd:attribute name="shipBy"> 
>    <xsd:simpleType> 
>     <xsd:restriction base="xsd:string"> 
>      <xsd:enumeration value="air"/> 
>      <xsd:enumeration value="land"/> 
>      <xsd:enumeration value="any"/> 
>     </xsd:restriction> 
>    </xsd:simpleType> 
>   </xsd:attribute> 
> </xsd:complexType> 

The only workaround is to pull the types out and name them.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 7 June 2001 08:07:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT