What is the set of "in-scope schemas" for a reference (such as a reference to a substitution element)?

Hi Folks,

The following no-namespace schema includes three schemas and it declares a metro element that is substitutable for a subway element:

metro.xsd
-----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    
    <xs:include schemaLocation="A.xsd" />
    <xs:include schemaLocation="B.xsd" />
    <xs:include schemaLocation="C.xsd" />
    
    <xs:element name="metro" substitutionGroup="subway" />

</xs:schema>
-----------------------------------------------------------------------------

Where is the subway element? Where *could* it be located? That is, what schema files could it be located in?

Answer: it could be located in A.xsd, B.xsd, C.xsd, or any schema file they include. Also, if metro.xsd is included by parent.xsd, then the subway element may be located in parent.xsd or any schema it includes. Further, if parent.xsd is included by grandparent.xsd, then the subway element may be located in grandparent.xsd or any schema it includes. Also for great-grandparent.xsd, great-great-grandparent.xsd, and so on.

I will use the term "in-scope schemas" to refer to all the schemas that could contain the subway element. 

Definition of in-scope-schemas:

The in-scope schemas for schema s are:
1. s
2. for each included schema, s'
         in-scope schemas s'
3. for the schema, p, that includes s:
        in-scope schemas p

Note: by "included schema" I mean xs:include, xs:redefine, and xs:override.

QUESTIONS

1. Is "in-scope schemas" the right term?
2. Is my definition of in-scope schemas complete and correct? 

/Roger

Received on Sunday, 25 September 2011 13:31:40 UTC