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

Mixing no-namespace and namespace XML Schemas

From: Oliver M. Haynold <oliver60201@hotmail.com>
Date: Sat, 03 Jan 2004 15:14:41 -0600
To: xmlschema-dev@w3.org
Message-ID: <pan.2004.01.03.17.52.14.645877@hotmail.com>

Hello:

I have an application where I want to elements that don't have a namespace
(from the TEI) with elements that are associated with a namespace (some
own extensions that are orthogonal to the TEI and could also be used with
XHTML etc.). Now I would like to use XML Schemata to express these
vocabularies, the immediate reason being that I would like to edit my
documents with Syntext Serna. In order to make these schemata I have
written my own little DTD to XSD converter, which I plan to release under
the GPL as soon as the schemata it generates actually seem to work like
the should.

For the namespaceless TEI schema, I declare the schema like this:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     xmlns:quot="http://www.northwestern.edu/pubweb/omh/Quotable/"
  <xsd:import 
   schemaLocation="/some_path/quotable/xsd/quotable.xsd"
   namespace="http://www.northwestern.edu/pubweb/omh/Quotable/"/>
  <!-- Actual element definitions go here -->
</xsd:schema>

So far so good. Now, in order to use this in quotable.xsd schema I declare
there:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:quot="http://www.northwestern.edu/pubweb/omh/Quotable/"
    targetNamespace="http://www.northwestern.edu/pubweb/omh/Quotable/">
  <xsd:import
  schemaLocation="/home/oliverh/software-projects/quotable/xsd/tei.xsd"/>
</xsd:schema>

This should, if I understood the XML Schema specification correctly, mean
that all elements I reference in the second file (quotable.xsd) without a
namespace prefix are to be taken from the tei.xsd file.

Alas, if I try to validate a document with these schemata with XSV (or to
use them in Serna which uses XSV internally), it seems that XSV doesn't
understand the import statement for the empty-namespace. The XSV output
reports that XSV found the import statement, but, for some reason chose
not to read it:

<schemaDocAttempt
    URI="file:/home/oliverh/software-projects/quotable/xsd/tei.xsd"
    otherLocs=""
    outcome="skipped" source="import"/>

Little wonder then, that it generates hundreds of errors because it
doesn't know about the elements declared there.

Did I misunderstand the Schema specification entirely, or is this really a
bug/missing feature of XSV? The following snippet in XSV:

  ne.newAttr('outcome','skipped')   # i.e. we chose to only pursue
                                    # one file per import

that generates the "skipped" message would seem to indicate that XSV
thinks that it already did import the Schema for the non-namespace, but
I don't know whether it is my (ab?)use of XML Schema or a problem with XSV
that causes this problem.

Regards from the Black Forest,

     Oliver
Received on Saturday, 3 January 2004 16:43:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:41 GMT