Re: Default namespaces and <includes>

"Aung Aung" <aaung@microsoft.com> writes:

> >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.
> 
> Henry,  Your answer does not quite answer the question Mike is asking.
> How about references in the includee to
> components defined a different includee??
>  
> The example of the issue is below. 
> Questions:  
>     1. should the "a.xsd" be valid XSD? please note that type="foo" in
> b.xsd is not qualified (there is no namespace declared for it).
>  
>  
> a.xsd~~~~~~~~~~
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="foo" xmlns="foo">
>    <xsd:include schemaLocation="b.xsd" />
>    <xsd:include schemaLocation="c.xsd" />
> </xsd:schema>
>
> b.xsd~~~~~~~~~~~
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>    <xsd:element name="foo" type="foo"/>
> </xsd:schema>
> <!-- 
>      Q?: Does "b.xsd" requires namespace declaration
>                      xmlns="foo" 
> -->

This _is_ answered in my reply.  type='foo' is interpreted in the
context of b.xsd as an XML document, in which there is no default NS
declaration, so this is a reference to {None}foo _as it stands_.

> c.xsd~~~~~~~~~~~
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:simpleType name="foo">
>   <xsd:restriction base="xsd:string">
>    <xsd:enumeration value="test"/>
>   </xsd:restriction>
>  </xsd:simpleType>
> </xsd:schema>

And this defines {None}foo, since there is no target namespace.

So despite the fact that this _is_ an example of chameleon include,
which was explicitly not addressed by my reply, including both these
files will always work:

 a) They are included into a schema which itself has no target
    namespace, in which case they are unchanged and {None}foo will match
    {None}foo
 b) They are chameleon included into a schema which does have a target 
    namespace, in which case both the ref and the def will be
    converted to {[tns]}foo.

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 15:11:34 UTC