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/Nouns/Personnel.xsd"/>
  <xs:include schemaLocation="http://xml/OAGIS/Resources/Verbs/Get.xsd"/>
</xs:schema>

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"
             schemaLocation="oagis.xsd"/>
  <xs:include schemaLocation="http://xml/Nouns/Personnel.xsd"/>
</xs:schema>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 24 September 2002 05:13:36 UTC