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

Re: Question about xs:import

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 24 Sep 2002 10:06:11 +0100
Message-ID: <33327780944.20020924100611@jenitennison.com>
To: Ryan.Barr@ejgallo.com
Cc: xmlschema-dev@w3.org

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/Nouns/Personnel.xsd"/>
  <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 05:13:36 UTC

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