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 10:19:41 -0800
To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>, <w3c-xml-schema-ig@w3.org>
Cc: <www-xml-schema-comments@w3.org>
Message-ID: <MNELKPFAIFJKHNJLJDOIMEHMCPAA.matt@westbridgetech.com>

Welcome to the club - better late than never.  Of course, one of the points
of the original NUN proposal was that the prefix to the local name was the
namespace.   Also, nested definitions allow us to get rid of anonymous types
and allow much better control of restriction/extension.  It would be good to
discuss this issue _before_ we decide on a SCD syntax, as it allows a
cleaner syntax where a name is always 0 or more type names followed by 0 or
1 element or attribute name.  For example:

<xs:schema targetNamespace="schema1">
  <xs:complexType name="foo">
     <xs:complexType name="bar">
          <xs:element name="x" type="xs:int" minOccurs="0"/>
          <xs:element name="y" type="xs:int" maxOccurs="10"/>
     <xs:element name="locFoo" type="bar"/>
       <xs:element ref="locFoo"/>
       <xs:element name="z" type="xs:int" minOccurs="0"/>
  <xs:element name="foo" type="foo"/>
  <xs:complexType name="restrictFoo">
        <xs:restriction base="foo" xs:foo="namespace of local foo above">
           <xs:complexType name="restrictBar">
                 <xs:restriction base="foo:bar">
                       <xs:element ref="foo:y" maxOccurs="5"/>
           <xs:element name="locFoo" type="restrictBar"
              <xs:element ref="locFoo"/>

Note that all elements are reached through a trail of complexTypes, so
complexTypes can be treated as namespaces - the current alternation syntax
makes that very muddy.  This also allows us to treat namespaces as coming in
two flavors - ordered and unordered.  The example of an unordered namespace
is a schema, and complexTypes are the ordered ones.  Which is to say that
all namespaces are of a nested structure containing element and attribute

But if a local element is in the namespace of its complexType, given your
syntax below, then surely as a logical consequence:

<a:BE xmlns:a="urn:a:aaa"

is valid because it puts x and y in their actual namespace and:

<a:BE xmlns:a="urn:a:aaa"><a:x>a</a:x><a:y>2</a:y></a:BE>

is not because it doesn't.

Note that if we make the change that puts local elements in the namespace of
their enclosing type - as is being suggested - then a definition that had
local elements unqualified, eg:

  <xs:complexType name="Base" >
      <xs:element name="x" type="xs:int"/>
      <xs:element name="y" type="xs:int" minOccurs="0"/>

which would be the current version of your complexType would have an
instance looking like:

<a:BE xmlns:a="urn:a:aaa"><x>1</x><y>2</y></a:BE>

which could be brought up to snuff by injecting some xmlns default

<a:BE xmlns="a.xsd#xsucd(ct::a:Base)"><x>1</x><y>2</y></a:BE>

which could be easily accomplished with a perl script and wreak much less
havoc on existing applications than would be the case for a schema with
qualified attributes.


-----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

The one change being considered for version 1.1 which would make this
work no matter what, without requiring the intervening stub, is the
move from local declaration within content models to local declaration
within types.  Combined with UCDs, this would allow something like

<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" form="qualified"/>
      <xs:element ref="x" />
      <xs:element ref="y" minOccurs="0"/>
  <xs:element name="BE" type="a:Base" />

<xs:schema targetNamespace="urn:b:bbb"
 <xs:import namespace="urn:a:aaa" schemaLocation="a.xsd"/>
  <xs:complexType name="Derived">
      <xs:restriction base="a:Base"
          <xs:element ref="aBase:x" />
          <xs:element name="aBase:y" minOccurs="1" />

I actually rather like the idea of treating complex type definitions
as namespaces within which the names of their local element
declarations sit.

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, 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/
 [mail really from me _always_ has this .sig -- mail without it is forged
Received on Thursday, 5 December 2002 13:20:16 UTC

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