Included <schema>

Hello,

I always thought that an included schema document may refer to 
components that are defined in the including <schema> even if they are 
not directly reachable if we start from the included schema.

More clearly the following sample should be valid:

test.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:include schemaLocation="m.xsd"/>
   <xs:element name="root">
     <xs:complexType>
       <xs:sequence maxOccurs="unbounded">
         <xs:element ref="content"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
   <xs:element name="a" type="xs:string"/>
</xs:schema>

m.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
   <xs:element name="content">
     <xs:complexType>
       <xs:sequence minOccurs="0">
         <xs:element ref="a"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
</xs:schema>

Now, the spec says in http://www.w3.org/TR/xmlschema-1/#src-include:
***
Schema Representation Constraint: Inclusion Constraints and Semantics
In addition to the conditions imposed on <include> element information 
items by the schema for schemas, all of the following must be true:
1 If the ·actual value· of the schemaLocation [attribute] successfully 
resolves one of the following must be true:
1.1 [...]
1.2 It resolves to a <schema> element information item in a well-formed 
information set, which in turn corresponds to a valid schema.
***

Does this "which in turn corresponds to a valid schema" mean that the 
above schema starting from test.xsd should be considered invalid because 
m.xsd is not valid itself?

Neither Saxon EE nor Xerces report problems when validating test.xsd so 
my guess is that there is some other place in the spec that allow this 
case and maybe the "corresponds to a valid schema" here does not mean 
that the module itself is a valid schema but that all the modules that 
define components in the same namespace should form a valid schema.
Anyway, I will appreciate some insight into this.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Received on Tuesday, 12 February 2013 09:48:25 UTC