[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Complex type inheritance is evil!
- From: ht@cogsci.ed.ac.uk (Henry S. Thompson)
- To: "Anderson, John" <John@Barbadosoft.com>
- Date: Thu, 07 Jun 2001 13:06:38 +0100
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/