- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 09 Nov 2000 10:02:57 +0000
- To: Naomi Dushay <naomi@cs.cornell.edu>
- Cc: www-xml-schema-comments@w3.org
Naomi Dushay <naomi@cs.cornell.edu> writes: > I am writing schemas for fragments of XML that will be inside another > XML doc. These schemas-for-fragments may want to set the "maxOccurs" or > "minOccurs" attribute for elements that are at the top level. Two parts > to the question: > > 1. is it legit for a schema to have more than one top level > element? > > example: > <schema> > <element name="topA" > type="typeA" /> > <element name="topB" > type="typeB" /> > <complexType name="typeA"> > ... > </complexType> > <complexType name="typeB"> > ... > </complexType> > </schema> Sure. XML Schema does not itself determine what element declaration is used to start validation -- that's a matter for negotiation between user, validator and instance. > 2. the following isn't passing through Schema validation: > should it? > > <schema> > <element name="topA" type="typeA" maxOccurs="3" /> > <element name="topB" type="typeB" minOccurs="0"/> > <complexType name="typeA"> > ... > </complexType> > <complexType name="typeB"> > ... > </complexType> > </schema> > > schema validation says attribute min/maxOccurs is not > defined. You can't put min/max on global element declarations -- min/max only make sense in the context of content models. 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, 9 November 2000 05:03:00 UTC