W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2002

RE: Question about xs:import

From: Mark Feblowitz <mfeblowitz@frictionless.com>
Date: Tue, 24 Sep 2002 15:07:10 -0400
Message-ID: <4DBDB4044ABED31183C000508BA0E97F040AC003@fcpostal.frictionless.com>
To: "'Jeni Tennison'" <jeni@jenitennison.com>, Ryan.Barr@ejgallo.com
Cc: xmlschema-dev@w3.org

While the adaptor schema may be the safest way to go, I believe that most
parsers treat separate import statements from the same namespace as distinct
instructions to import separate sets of definitions belonging to the same
namespace. That's somewhat different from viewing an import as importing all
definitions for a given namespace, treating the second and subsequent import
statements as being redundant. 

The need to create adaptors for each combination of assembled components can
result in a large number of extraneous files.


-----Original Message-----
From: Jeni Tennison [mailto:jeni@jenitennison.com]
Sent: Tuesday, September 24, 2002 5:06 AM
To: Ryan.Barr@ejgallo.com
Cc: xmlschema-dev@w3.org
Subject: Re: Question about xs:import

Hi Ryan,

> My question is simply this, is importing the files
> OAGIS/../Personnel.xsd and OAGIS/../Get.xsd into the
> http://www.openapplications.org/oagis namespace a violation of the
> spec? It doesn't seem to be, if anyone has a reference in the spec
> of were it is stated that this is allowed that would be great.

I don't think that it's in violation of the spec, but I don't think
that it will work. The same thing applies here as it does when you
specify multiple schema locations for the same namespace using
xsi:schemaLocation in the instance document. If a schema validator is
told that *the* schema for a certain namespace is at a particular
place, and you later tell it that *the* schema for a certain namespace
is in another location, it will ignore the second hint if it's managed
to find a schema from the first -- as far as the validator's
concerned, it already has *the* schema for that namespace, so it
doesn't need another one.

In your case, you need to build an "adapter schema" in the namespace
that you want to import which *includes* the two schemas:

<xs:schema targetNamespace="http://www.openapplications.org/oagis">
  <xs:include schemaLocation="http://xml/OAGIS/Resources/Verbs/Get.xsd"/>

You can then *import* this single schema into your own schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://www.openapplications.org/oagis"
  <xs:include schemaLocation="http://xml/Nouns/Personnel.xsd"/>



Jeni Tennison
Received on Tuesday, 24 September 2002 15:07:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:58 UTC