- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 15 Dec 2000 09:46:41 +0000
- To: Yimin Zhu <yzhu@citadon.com>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Yimin Zhu <yzhu@citadon.com> writes: > If I have a complextType A containing two sub elements B and C. > > <complexType name="A"> > <complexContent> > <element name="B" type="string"/> > <element name="C" type="string"/> > </complexContent> > </ComplexType> Not valid as written, should be <complexType name="A"> <element name="B" type="string"/> <element name="C" type="string"/> </complexType> > Now I wish to define an element E, which is inherited from A. Also, E can > only have B in its content model. Can I do it by using restriction as > following? > <element name="E"> > <complexType> > <xsd:complexContent> > <xsd:restriction base="A"> > <xsd:all> > <xsd:element name="B" > type="xsd:string"/> > </xsd:all> > </xsd:restriction> > </xsd:complexContent> > </complexType> > </element> Again, typos corrected, and assume prefix 'my' for targetNamespace: <element name="E"> <complexType> <complexContent> <restriction base="my:A"> <all> <element name="B" type="string"/> </all> </restriction> </complexContent> </complexType> </element> No, this is not valid. Restriction can only eliminate optional parts of content models, and the 'C' element in the 'A' type was not optional. 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 Friday, 15 December 2000 04:46:44 UTC