- From: Biron,Paul V <Paul.V.Biron@kp.org>
- Date: Wed, 10 Jul 2002 09:34:01 -0700
- To: "'Gary Cramblitt'" <garycramblitt@comcast.net>, xmlschema-dev@w3.org
> -----Original Message----- > From: Gary Cramblitt [SMTP:garycramblitt@comcast.net] > Sent: Monday, July 08, 2002 2:41 PM > To: xmlschema-dev@w3.org > Subject: What good is Restriction? > > Quoting from the XML-Schema Primer, when deriving a new type > by restricting a base complex type... > --- > 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 if I must repeat everything in the base type as well as the > restrictions, what good is it? Why not just create a new type > and be done with it? My conclusion is that while XSD claims > to be object oriented, it doesn't support full inheritance, at least > not in this instance. Maybe this is similar to Microsoft's > "Interface Inheritance"? Anybody know why this requirement > was put in the spec? Just wondering... > Others have attempted to address the 'why use restriction' question...I'll see if I can address the 'why do you have to replicate everything in a restriction' question. Believe me, if the WG had come up with an alternative we would put that in the spec...non of us like it either. Here's a real simple case (artificial, as it may be...I'm sure that given a few moments we could all come up with a "useful" example) that illustrates the difficulty: <xs:complexType name='base'> <xs:sequence> <xs:element name='a' minOccurs='0'> <xs:complexType> ... </xs:complexType> </xs:element> <xs:element name='b'> <xs:complexType> <xs:sequence> <xs:element name='a' minOccurs='0'> <xs:complexType> ... </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> If I write a restriction of 'base' that only mentions the element 'a'...which model does it refer to? With locally declared elements it is possible to have more than one element of a given "name" in a content model and the WG couldn't figure out how to handle restriction in the face of this without requiring the relevent portions of the content model to be "duplicated". We explored several alternatives but none panned out. If you (or anyone, for that matter) has a viable solution, by all means, post it to www-xml-schema-comments@w3.org and we will certainly consider it for a future version of the spec. pvb Schema WG member (speaking for myself and not the WG)
Received on Wednesday, 10 July 2002 12:59:10 UTC