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

Question on XSD 1.1 cyclic <override>

From: Kevin Braun <kbraun@obj-sys.com>
Date: Wed, 23 Dec 2009 16:53:26 -0500
Message-ID: <4B329156.8040107@obj-sys.com>
To: www-xml-schema-comments@w3.org
Hi,

Consider the following, where a.xsd overrides b.xsd, which overrides 
a.xsd, which....

<!-- a.xsd -->
<schema
   xmlns="http://www.w3.org/2001/XMLSchema"
   targetNamespace="uri:example"
   id="D1"
 >
   <override schemaLocation="b.xsd" id="O1">
      <element name="elementB" type="string"/>
   </override>

   <element name="elementA" type="decimal"/>
</schema>

<!-- b.xsd -->
<schema
   xmlns="http://www.w3.org/2001/XMLSchema"
   targetNamespace="uri:example"
   id="D2"
 >
   <override schemaLocation="a.xsd" id="O2">
      <element name="elementA" type="string"/>
   </override>

   <element name="elementB" type="decimal"/>
</schema>

The spec seems to say that if override(O1, D1) = D1 and override(O2, D2) 
= D2 (both true, I think) then it is okay that target_set(O1) includes 
D1 and target_set(O2) includes D2.  Yet, it seems that schema(D1) should 
contain two conflicting declarations for elementA.

The spec says:
*Note:* It is /not/ forbidden for the schema document D containing an 
<override> <http://www.w3.org/TR/xmlschema11-1/#element-override> 
element E to be in the ·target set· 
<http://www.w3.org/TR/xmlschema11-1/#key-targetset> of E.

[1] If applying the override transformation specified in Transformation 
for |xs:override| (§F.2) 
<http://www.w3.org/TR/xmlschema11-1/#override-xslt> to D and E results 
in a schema document equivalent to D (e.g. when none of the [children] 
<http://www.w3.org/TR/xml-infoset/#infoitem.element> of D, or of any 
<redefine> <http://www.w3.org/TR/xmlschema11-1/#element-redefine> and 
<override> <http://www.w3.org/TR/xmlschema11-1/#element-override> 
elements in D match any of the [children] 
<http://www.w3.org/TR/xml-infoset/#infoitem.element> of E, except for 
the [children] <http://www.w3.org/TR/xml-infoset/#infoitem.element> of E 
themselves), then the effect is the same as for a cyclic set of 
<include> <http://www.w3.org/TR/xmlschema11-1/#element-include> 
references, or as for multiple inclusions of the same document (as 
described in the note at the end of Assembling a schema for a single 
target namespace from multiple schema definition documents (|<include>|) 
(§4.2.3) <http://www.w3.org/TR/xmlschema11-1/#compound-schema>).

If applying the override transformation to D and E changes any of the 
XML representations of components, then the effect of D being in the 
·target set· <http://www.w3.org/TR/xmlschema11-1/#key-targetset> of E is 
the same as if two different schema documents containing conflicting 
definitions for the same components were included. ("As if" is inexact; 
in this case what happens is, precisely, that two schema documents with 
conflicting contents are included.)

Aren't the conditions given in the paragraph marked [1] insufficient to 
claim the same effect as for a cyclic set of <include> references?

Thanks & Regards,
Kevin
Received on Wednesday, 23 December 2009 21:56:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 23 December 2009 21:56:18 GMT