W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

qname interpretation in included files

From: Niko Matsakis <niko@alum.mit.edu>
Date: Thu, 30 Jan 2003 12:22:12 -0500 (EST)
To: xmlschema-dev@w3.org
Message-ID: <Pine.LNX.4.44.0301301210590.14835-100000@sub-zero.mit.edu>

I have a question about qname interpretation in included files.  In short,
my question is: What namespace bindings are in effect when we interpret
the qnames in an attribute, such as the type attribute of xs:element.  
It doesn't seem to be the same as the bindings that are on the node,
for the reasons I will explain below.

Suppose I have a generic schema with no target namespace that I
am attempting to reuse in a number of contexts.  Suppose it
declares a complex type 'flight-plan', and an abstract element of
that type with the same name.  (I am just making up these type names,
so don't try to read any meaning in them)

flight-plan.xsd:
<xs:schema 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified">

        <xs:complexType name="flight-plan"/>
        <xs:element name="flight-plan" type="flight-plan" abstract="true"/>

</xs:schema>

Now I try to use that schema from this other schema:

airplane.xsd:
<xs:schema 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	xmlns="my-namespace"
	targetNamespace="my-namespace"
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified">

        <xs:include schemaLocation="flight-plan.xsd"/>

        <xs:complexType name="flight">
                <xs:complexContent>
                        <xs:extension base="flight-plan">
                                <xs:attribute name="number" type="xsd:double"/>
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>

</xs:schema>

Now here is my question.  It is clear that the complexType flight-plan
will be instantiated as {my-namespace}flight-plan due to the targetNamespace.  
Furthermore, I assume that the type which "flight" is extending 
is {my-namespace}flight-plan due to the xmlns="". 

However, it is not clear to me what type the abstract element 
"flight-plan" in the included file is suppoesd to be extending.  The 
intention would seem to be {my-namespace}flight-plan, however, it seems
like the type attribute on the 'flight-plan' element has no default
namespace binding on it, so it would in fact be interpreted as {}flight-plan.

So my question again is: what namespace bindings apply on the interpretation of
qname attributes?  It can't be the bindings on the node that the attribute
is on, it seems, because that would lead to {}flight-plan.  But it isn't
targetNamespace, I don't think, as the schemas I have seen use both 
xmlns="my-namespace" and targetNamespace="my-namespace" as quite independent
entities.

Thank you!


niko
Received on Thursday, 30 January 2003 12:16:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT