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

RE: qname interpretation in included files

From: Dare Obasanjo <dareo@microsoft.com>
Date: Thu, 30 Jan 2003 09:48:40 -0800
Message-ID: <B885BEDCB3664E4AB1C72F1D85CB29F804B54BD2@RED-MSG-10.redmond.corp.microsoft.com>
To: "Niko Matsakis" <niko@alum.mit.edu>, <xmlschema-dev@w3.org>

Namespace declarations have nothing to do with the qualified names of
elements declarations, attributes declarations or types. These are all
dependent on the target namespace of the schema they are defined in or
the including schema if they are defined in a schema with no target

Also you should understand how chamaleon schemas work. The article below
goes into some detail on understanding how namespaces work in W3C XML


Some days you are the bug; some days you are the windshield.

This posting is provided "AS IS" with no warranties, and confers no

> -----Original Message-----
> From: Niko Matsakis [mailto:niko@alum.mit.edu] 
> Sent: Thursday, January 30, 2003 9:22 AM
> To: xmlschema-dev@w3.org
> 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:49:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:59 UTC