W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2002

RE: Feature incompatiblity in XML Schema 1.0

From: Matthew Fuchs <matt@westbridgetech.com>
Date: Thu, 5 Dec 2002 09:17:22 -0800
To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>, "Don Box" <dbox@microsoft.com>
Cc: <www-xml-schema-comments@w3.org>, "Ashok Malhotra" <ashokma@microsoft.com>, "Martin Gudgin" <mgudgin@microsoft.com>, "Allen Brown" <allenbr@microsoft.com>
Message-ID: <MNELKPFAIFJKHNJLJDOIMEHKCPAA.matt@westbridgetech.com>


I believe this is (or ought to be) illegal because the restriction may allow
content not legal in the parent.  However, if it is legal, you win the grand
prize - an example where static type checking, as I've defined it elsewhere,
is broken.  Note my insertions below.


-----Original Message-----
From: www-xml-schema-comments-request@w3.org
[mailto:www-xml-schema-comments-request@w3.org]On Behalf Of Henry S.
Sent: Thursday, December 05, 2002 1:52 AM
To: Don Box
Cc: www-xml-schema-comments@w3.org; Ashok Malhotra; Martin Gudgin; Allen
Subject: Re: Feature incompatiblity in XML Schema 1.0

You analysis is correct, but I don't understand the implicit
evaluative component of your message - why is this a problem that
needs to be fixed?  By making a declaration both local and qualified,
the author has essentially staked a permanent claim on the association
between those qualifided names and their types in that context.  You can
override this, but to do so you have to usurp the author's namespace
explicitly, either using <redefine>, or as follows:

<xs:schema targetNamespace="urn:a:aaa"
  xmlns:a="urn:a:aaa" >
  <xs:complexType name="Base" >
      <xs:element name="x" type="xs:int" form="qualified" />
      <xs:element name="y" type="xs:int" minOccurs="0" form="qualified"/>
  <xs:element name="BE" type="a:Base" />

<xs:schema targetNamespace="urn:a:aaa"
  xmlns:a="urn:a:aaa" >
 <xs:include schemaLocation="a.xsd"/>
 <xs:element name="y" type="xs:int"/>
 <xs:element name="x" type="xs:int"/>

<xs:schema targetNamespace="urn:b:bbb"
 <xs:import namespace="urn:a:aaa" schemaLocation="aprime.xsd"/>
  <!-- MDF - note use of substitution groups -->
  <xs:element name="y-prime" type="xs:int" substitutionGroup="a:y"/>
  <xs:element name="x-prime" type="xs:int" substitutionGroup="a:x"/>
  <!-- MDF -->
  <xs:complexType name="Derived">
      <xs:restriction base="a:Base" >
          <xs:element ref="a:x" />
          <xs:element ref="a:y" minOccurs="1" />

As long as the local element decls you want to appropriate don't have
anonymous type definitions, such a move is always possible.

MDF>  Because of the presence of substitution groups, the restriction would


which clearly is not valid for <a:BE>.  Once again, very nasty non-local
effects become possible - the element subtypes could be in a third schema
completely.  It's also very nasty for implementation - since there could be
any number of layers, restrictions with qualified elements would need to be
matched against all the ancestor types, not just the most local one - I'll
be no one does this.  Therefore, if this is not illegal, it should be made

Received on Thursday, 5 December 2002 12:17:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:59 UTC