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

Re: Problems with the namespace of substitution groups

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 26 Jan 2001 12:23:57 +0000
To: "Martin Bryan" <mtbryan@sgml.u-net.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5bitn2tsbm.fsf@cogsci.ed.ac.uk>
"Martin Bryan" <mtbryan@sgml.u-net.com> writes:

> I'm having trouble making substitution groups work. In the specification the
> example given of a substitution group has
> <xs:element name="facet" type="xs:facet" abstract="true"/>
>  <xs:element name="encoding" substitutionGroup="xs:facet">
> where facet has been defined using <xs:complexType name="facet">
> I'm trying to work out what the significance of the addition of the xs:
> namespace to the type definition for the abstract element and for the
> substitutionGroup attribute.

All references to definitions and declarations in XML Schema are via
qualified names (QNames).  Since 'facet' is a name in the XML Schema
namespace (which names both a (complex) type and an element),
references to it must be qualified with that namespace.

> Could this be something to do with the reason
> that if I try to import a file containing just the complexType and abstract
> element definitions into a schema that is designed to instatiate the
> abstract instances I start getting error messages from XML Spy?

Could be, I suppose.  Sample files would help diagnose the problem.
The following is a sketch of what I take it you have in mind


<xs:schema targetNamespace="http://www.example.com/core"
 <xs:complexType name="t1">
    . . .

 <xs:element name="ce1" abstract="true" type="c:t1"/>

 . . .



<xs:schema targetNamespace="http://www.example.com/local"

 <xs:import namespace="http://www.example.com/core"

 <xs:complexType name="l1">
   <xs:extension base="c:t1">
    . . .

 <xs:element name="le1" type="l:l1" substitutionGroup="c:ce1"/>

 . . .


> What is the relationship of the name space of an abstract element or
> complexType definition to the targetNamespace and the null namespace
> (xmlns=...)  properties of the containing schemas?

I hope the above example clarifies this.  Declarations and definitions 
in a schema document _always_ declare/define things with names in the
targetNamespace of the <schema> document element which contains them.

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, 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/
Received on Friday, 26 January 2001 07:24:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:49 UTC