Re: Default namespaces and <includes>

Mike_Leditschke@nemmco.com.au writes:

> I would appreciate some clarification as to what the
> XML Schema spec says about the operation of
> namespace definitions on included schemas.
> 
> For example, assume I set up a default namespace
> on the schema element of the including schema.
> 
> If I now <include> a schema, do all the
> namespace mappings active at the point of the
> include carry into the included document?
> 
> I am thinking particularly of the best practice
> document on default namespaces, approach 2.
> That's the one where the XML Schema namespace
> is qualified, and the default namespace is the
> target namespace.
> 
> It shows references from the including document to
> the included document not including a namespace
> prefix. It doesn't give an example of the reverse.
> 
> I believe the reverse should be true, given my very
> rough understanding of how includes work. However
> I would like to know where the XMl Schema spec
> covers this.

The interpretation of all attributes in XML Schema documents declared
to be of type QName, including 'type', 'base' and 'ref', is always
strictly per the Namespaces REC for element names, i.e. qualified if
prefixed or if (unprefixed and default NS decl in scope).

The interpretation of all 'name' attributes in XML Schema documents is 
that they provide names for the associated definition or declaration
in the namespace determined by the enclosing <schema> element's
'targetNamespace' attribute (with an exception for chameleon includes, 
which is not relevant here).

So since valid includes must be from a schema doc't to a schema doc't
which _share_ a targetNamespace value, references in the includer to
components defined in the includee look just like references in the
includer to itself.  No transfer of namespace bindings, which are
purely a matter for the XML Namespaces REC, is implied or required.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Thursday, 27 September 2001 05:20:41 UTC