Response to XML Schema Last Call question 119: Question on Includ e

I am writing you on behalf of the XML Schema WG regarding your Last Call
request for clarification on Include. 

If the response below does not adequately satisfy your request, or if you
need additional clarification on this subject, please let me know.

Thank you,

Ugo Corda
Member of W3C XML Schema WG

=============================

Question LC-119: Question on Include:

When I write a XML schema, for instance schema1.xsd, in which is included
another schema, schema2.xsd, the elements's, attributes's and types's name
of child of schema1.xsd must be not equal at elements's, attributes's and
types's name of child of schema2.xsd? 

Response:

According to the Schema standard, schema1.xsd and schema2.xsd will have the
same targetNamespace. In fact, Schema Part 1, Section 6.2.1, "Assembling a
schema for a single target namespace from multiple schema definition
documents", states:

<<Schema components for a single target namespace can be assembled from
several schema documents, that is several schema element information items.
... A schema information item may contain any number of include elements.
... The XML Schema ... then consists of all the components its [children]
correspond to and all the components of all the XML Schemas corresponding to
those included schema documents. Such included components must either (a)
have the same targetNamespace as the includeing schema document, or (b) no
targetNamespace at all, in which case all the top-level included components
are converted to the includeing schema document's targetNamespace>>

Also according to the Schema standard, within the same targetNamespace type
definitions, attribute declarations and element declarations each define a
separate symbol space within which names must be unique. Schema Part1,
Section 2.5, "Names and Symbols Spaces", states:

<<This specification therefore introduces the term [Definition:] symbol
space to denote a collection of names, each of which is unique with respect
to the others. ... There is a single distinct symbol space within a given
target namespace for each kind of definition and declaration component
identified in XML Schema Abstract Data Model (§2.2), except that within a
target namespace, simple type definitions and complex type definitions share
a symbol space. Within a given symbol space, names are unique, but the same
name may appear in more than one symbol space without conflict. For example,
the same name can appear in both a type definition and an element
declaration, without conflict or necessary relation between the two.>>

So names from all type definitions of schema1.xsd and schema2.xsd must be
unique. The same applies to names from all global attribute declarations of
schema1.xsd and schema2.xsd, and to names from all global element
declarations of schema1.xsd and schema2.xsd.

This rule does not apply to non-global declarations from schema1.xsd and
schema2.xsd. The same Section 2.5 referenced before states:

<<Locally scoped attribute and element declarations are special with regard
to symbol spaces. Every complex type definition defines its own
local attribute and element declaration symbol spaces, where these symbol
spaces are distinct from each other and from any of the other
symbol spaces. So, for example, two complex type definitions having the same
target namespace can contain a local attribute declaration
for the unqualified name "priority", or contain a local element declaration
for the name "address", without conflict or necessary relation
between the two.>>

Received on Thursday, 6 July 2000 17:34:00 UTC