Michael,
I apologize - I did already resolve this with a couple of e-mails between
Henry and myself going back and forth, but it appears that we didn't cc the
comments list on this.
Anyway, we came to the same conclusion: as any global element or complexType
declared in such a schema is practically unreferenceable - although not
illegal - a warning in the primer would probably be the best solution.
Alexander
... Alexander Falk
... President, CEO
... Altova, Inc. - The XML Spy Company
=========================================================================
XML Spy 3.0 - the first true Integrated Development Environment for XML
Visit http://www.xmlspy.com/ to download a free 30-day evaluation version
=========================================================================
-----Original Message-----
From: C. M. Sperberg-McQueen [mailto:cmsmcq@acm.org]
Sent: Wednesday, December 27, 2000 18:54
To: ht@cogsci.ed.ac.uk
Cc: Falk, Alexander; www-xml-schema-comments@w3.org
Subject: Re: CR Feedback and Implementation
At 2000-12-18 07:23, Henry S. Thompson wrote:
> "Falk, Alexander" <al@altova.com> writes:
>> 1) the CR should perhaps expressedly inform the reader, that any
>> schema document that uses a default namespace (ie no prefix) to
>> refer to "http://www.w3.org/2000/10/XMLSchema" must have a
>> targetNamespace - otherwise any type="..." or ref="..." can not be
>> correctly attributed to either the built-in types of XML schema or
>> the types that the user defines in his/her schema
> I'm not sure I understand. The following is perfectly valid:
> <schema xmlns="http://www.w3.org/2000/10/XMLSchema">
> <element name="foo">
> <sequence>
> <element name="bar" type="integer"/>
> <element name="baz" type="date"/>
> </sequence>
> </element>
> </schema>
Well, actually it's not. The 'sequence' element is not allowed there,
you have to wrap it in a complexType element.
But consider the case where the schema author actually wants to
refer to other things in the schema.
<schema
xmlns = "http://www.w3.org/2000/10/XMLSchema"
elementFormDefault="qualified"
>
<annotation>
<documentation>
This is a sample schema to demonstrate using the XML Schema
namespace as the default namespace for a schema without a
target namespace.
</documentation>
</annotation>
<annotation>
<documentation>This declaration is fine.</documentation>
</annotation>
<complexType name="tA">
<sequence><element type="integer" name="i"/></sequence>
</complexType>
<annotation>
<documentation>
These declarations, on the other hand, are unlikely to be
what any schema author will have in mind.
Complex types tB and tC won't be successful in saying what
types they are derived from.
</documentation>
</annotation>
<complexType name="tB">
<complexContent>
<extension base="tA">
<sequence><element type="integer" name="j"/></sequence>
</extension>
</complexContent>
</complexType>
<complexType name="tC">
<complexContent>
<extension base="tB">
<sequence><element type="integer" name="k"/></sequence>
</extension>
</complexContent>
</complexType>
<annotation>
<documentation>
Element type 'ace' will have trouble making clear which
elements are supposed to be its children.
</documentation>
</annotation>
<element name="ace">
<complexType>
<choice maxOccurs="unbounded" minOccurs="0">
<element ref="A"/>
<element ref="B"/>
<element ref="C"/>
<element ref="X"/>
</choice>
</complexType>
</element>
<annotation>
<documentation>
Element types A, B, C, and X will have trouble saying
what type they have.
</documentation>
</annotation>
<element type="tA" name="A"/>
<element type="tB" name="B"/>
<element type="tC" name="C"/>
<element type="tA" name="X"/>
</schema>
This is legal, but not useful. The schema I use (i.e. the schema
provided by our spec) for the XML Schema namespace does not declare
complex types named tA, tB, or tC, nor elements named A, B, C, or X.
So a document which tries to use this schema won't be able to use
anything declared here.
It's true that on some occasions one might successfully use the XML
Schema namespace as the default namespace in a schema document without
a target namespace, as illustrated by Henry's example. But precisely
because my example schema document is not illegal and won't by itself
raise any error messages, I think a casual warning (a bit weaker than
suggested by Alexander Falk) is probably a good idea: "Note that if
the XML Schema namespace is used as the default namespace, the schema
document itself should almost always have an explicit target
namespace. Otherwise, it will be impossible to refer to anything declared
in the schema from elsewhere in the schema." Perhaps the warning belongs
in the Primer, rather than the Structures spec.
C. M. Sperberg-McQueen