- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 16 Feb 2000 18:25:08 +0000
- To: www-xml-schema-comments@w3.org
achille@us.ibm.com writes: > Hi, > > I'm trying to understand how tools can check if a complex type, derived > from another type by restriction, is valid. > It seems to me that the latest spec is unclear on this issue. > In the section 3.6.2.Deriving type definitions by restriction, it is said : > > "If the source definition has element-only or mixed content, restricting a > content model is also possible via the complexRestrictions option. In this > case each particle within the restriction is matched one for one with the > corresponding particle in the source definition, and in each case a > restriction must be effected, e.g. by narrowing the range of occurs, by > reducing the members of a disjunction or by replacing a wildcard with a > more explicit particle" > <schema targetNS="http//www.w3.org/XMLSchemaComments" > version="1.0" > xmlns="http://www.w3.org/1999/XMLSchema" > > > <type name="typeA" content="elementOnly"> > <element ref="elementA" minOccurs="0" maxOccurs="3"/> > <element ref="elementB" minOccurs="0" maxOccurs="1"/> > <element ref="elementA" minOccurs= "0" maxOccurs="*"/> > </type> > > <type name="typeB" source="typeA" derivedBy="restriction" > > <restrictions> > <element ref="elementA" minOccurs="1" maxOccurs="2"/> > </restrictions> > </type> You've slightly misunderstood the draft, which certainly could have been clearer. The 'one for one' above means in order, so by definition your first example above restricts the first 'elementA' and leaves the other two alone. I won't go on, because this aspect of the design has changed in the current (non-public) draft in a way which simplifies this issue, I hope you'll get to see it soon. 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 Wednesday, 16 February 2000 13:25:21 UTC