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

RE: qname interpretation in included files

From: Niko Matsakis <niko@alum.mit.edu>
Date: Thu, 30 Jan 2003 13:18:52 -0500 (EST)
To: Dare Obasanjo <dareo@microsoft.com>
cc: xmlschema-dev@w3.org
Message-ID: <Pine.LNX.4.44.0301301301160.14835-100000@sub-zero.mit.edu>

I think you are missing my point.  I realize that the names of
element declarations, attribute declarations, and types are NCNames and
receive their URIs from the targetNamespace.  However, when a type is
later referenced, as in

<xs:element name="surname" type="xs:string"/>

clearly the 'xs:string' is interpreted relative to some namespace
bindings, no?

So, as I said in my original e-mail, I want to know what the
set of namespace bindings that should be used to make that interpretation
are.

I read your article and it did not seem to address my question; all
examples of chameleon schemas that I have seen consist only of
type declarations, but what if a component IN the chameleon schema
tries to reference one of the types declared in itself?

Here is my example again:

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

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

</xs:schema>

Note that the abstract element 'flight-plan' references the type
'flight-plan-type' which is declared above it.

Now, in my including 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-type">
                               <xs:attribute name="number" type="xsd:double"/>
                       </xs:extension>
               </xs:complexContent>
       </xs:complexType>

</xs:schema>

byincluding flight-plan.xsd, we change the name of 'flight-plan-type' to
'{my-namespace}flight-plan-type', but now the reference to 'flight-plan-type'
in the element 'flight-plan' in flight-plan.xsd is refering to a non-existent
type.  So is the intention that the references in the included file are
resolved before it is included?  (i.e., it is determined which type
'flight-plan-type' refers to before the file is included). 

Do you see my question?  


niko

> 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
> namespace. 
> 
> Also you should understand how chamaleon schemas work. The article below
> goes into some detail on understanding how namespaces work in W3C XML
> Schema 
> 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml
> /html/xml08192002.asp
> 
> 
Received on Thursday, 30 January 2003 13:11:52 GMT

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