W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2004

Re: qualified local/global Re: Namespace problem

From: C. M. Sperberg-McQueen <cmsmcq@acm.org>
Date: 18 Aug 2004 12:55:05 -0600
To: Burak Emir <Burak.Emir@epfl.ch>
Cc: xmlschema-dev@w3.org
Message-Id: <1092855304.8820.115.camel@localhost>

On Wed, 2004-08-18 at 10:00, Burak Emir wrote:

> My confusion is all due to my belief that namespace prefixes would
> never play a role in attribute *values*, which is obviously wrong
> for XSDs.

As well as for XSLT stylesheets and XQueryX documents and any other
documents which have XPath expressions as attribute values.  If you
want to live in a world without QNames in attribute values or content,
then I think you need to go back to a world without the Namespaces
Recommendation.  (And when you find the wormhole that will take you
there, I bet a LOT of people would like to go back there with you.)

> I, for one, would appreciate an XSD syntax that makes these things
> more straightforward (=does not use xmlns attributes).

While I'm sympathetic to your view that having to specify both a
namespace prefix and the targetNamespace attribute for the target
namespace is a pain, I wonder whether all schema authors would find

  <xsd:element name="fallImportExport" 
    type="{grips://xml.recom-verlag.de/comm/plem}FallImportExport"/>
  <xsd:element name="fall" 
    type="{grips://xml.recom-verlag.de/comm/plem}plem:Fall"/>
  <xsd:element name="satzArt" 
    type="{http://www.w3.org/2001/XMLSchema}string" />

preferable to 

  <xsd:element name="fallImportExport" type="plem:FallImportExport"/>
  <xsd:element name="fall" type="plem:Fall"/>
  <xsd:element name="satzArt" type="xsd:string" />

Bear in mind (as the declaration for satzArt illustrates) that the
reason element/@type takes a QName rather than an NCName is that the
type used for an element is not necessarily in the target namespace of
the schema document.  You can of course write 

  <xsd:element name="fallImportExport" type="FallImportExport"/>
  <xsd:element name="fall" type="Fall"/>
  <xsd:element name="satzArt" type="xsd:string" />

if you make the target namespace the default namespace in the schema
document.

I hope this helps, even though the weary fact of the matter is that
with regard to namespaces nothing ever really helps except abandoning
the hope that they will someday make sense and feel natural, and
learning to live with them (note that some people do find namespaces
natural and sensible -- as far as I can tell they were born that way,
and others were born the other way, and there is no crossing over).

-C. M. Sperberg-McQueen
 World Wide Web Consortium
 MIT Computer Science and AI Lab
Received on Wednesday, 18 August 2004 18:55:05 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:10 UTC