W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2002

redefine: extending a group

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Tue, 19 Nov 2002 16:25:44 -0800
Message-Id: <8904C60CACA7D51191BC00805FEAAF43D10F2B@crdc-exch-7.crdc.kp.org>
To: "'www-xml-schema-comments'" <www-xml-schema-comments@w3.org>

Clause 6 of Schema Representation Constraint: Redefinition Constraints and Semantics [1] says:

	6 Within the [children], for each <group> the appropriate case among
	the following must be true:
	  6.1 If it has a <group> among its contents at some level the ·actual value·
	  of whose ref [attribute] is the same as the ·actual value· of its own name
	  attribute plus target namespace, then all of the following must be true:
	    6.1.1 It must have exactly one such group.
	    6.1.2 The ·actual value· of both that group's minOccurs and maxOccurs
	    [attribute] must be 1 (or ·absent·).
	  6.2 If it has no such self-reference, then all of the following must be true:
	    6.2.1 The ·actual value· of its own name attribute plus target namespace
	    must successfully ·resolve· to a model group definition in I.
	    6.2.2 The {model group} of the model group definition which corresponds
	    to it per XML Representation of Model Group Definition Schema Components
	    (§3.7.2) must be a ·valid restriction· of the {model group} of that model group
	    definition in I, as defined in Particle Valid (Restriction) (§3.9.6).

I read this as saying that the following is allowed:

<!-- in a.xsd -->
<xs:schema ...>
	<xs:group name='grp'>
		<xs:sequence>
			<xs:element name='test'/>
			<xs:element name='again' minOccurs='0' maxOccurs='unbounded'/>
		</xs:sequence>
	</xs:group>
</xs:schema>

<!-- in b.xsd -->
<xs:schema ...>
	<xs:redefine schemaLocation='a.xsd'>
		<xs:group name='grp'>
			<xs:sequence>
<!-- i.e., a restriction of grp -->
				<xs:element name='test'/>
				<xs:element name='again' maxOccurs='0'/>
			</xs:sequence>
		</xs:group>
	</xs:redefine>
</xs:sequence>

<!-- in c.xsd -->
<xs:schema ...>
	<xs:redefine schemaLocation='a.xsd'>
		<xs:group name='grp'>
			<xs:sequence>
<!-- i.e., an extension of grp -->
				<xs:group ref='grp'/>
				<xs:element name='anotherTest'/>
			</xs:sequence>
		</xs:group>
	</xs:redefine>
</xs:sequence>

but that the following isn't allowed:

<!-- in d.xsd -->
<xs:schema ...>
	<xs:redefine schemaLocation='a.xsd'>
		<xs:group name='grp'>
			<xs:sequence>
<!-- i.e., an extension of grp that explicitly duplicates the original content model -->
				<xs:element name='test'/>
				<xs:element name='again' minOccurs='0' maxOccurs='unbounded'/>
				<xs:element name='anotherTest'/>
			</xs:sequence>
		</xs:group>
	</xs:redefine>
</xs:sequence>

My question: why is it not allowed to "inline" the group that is being redefined via extension?  Was this just an oversight or is there some reason that I'm missing on first examination?  This same basic situtation exists with redefining attribute groups as well if I'm not mistaken.

If the schema contraint is correct, then the prose preceding it should be corrected because it reads:

	The definitions within the <redefine> element itself are restricted to
	be redefinitions of components from the <redefine>d schema document,
	in terms of themselves. That is,

		* Type definitions must use themselves as their base type definition;
		* Attribute group definitions and model group definitions must be
		supersets or subsets of their original definitions, either by including
		exactly one reference to themselves or by containing only (possibly
		restricted) components which appear in a corresponding way in their
		<redefine>d selves. 

which implies that d.xsd should be legal.

pvb

[1] http://www.w3.org/TR/xmlschema-1.htm#src-redefine
Received on Tuesday, 19 November 2002 19:27:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT