Re: Question about xsd:import / xsd:include standards (different pars er implementations)

On Tue, 2005-03-22 at 17:10, Hoang, Anthony M. wrote:
> Iÿm working with a set of schema files where ´A¡, ´B¡ and ´C¡
> represent different XML schema files.  ´A¡ and ´B¡ share a target
> namespace while ´C¡ sits in a different namespace.
> 
>   (1)  ´A¡ includes ´B¡
> 
>   (2)  ´A¡ references an attributeGroup from ´C¡
> 
>   (3)  ´B¡ imports ´C¡
> 
>  
> 
> In two XML parsers, I am required to also have:
> 
>   (4)  ´A¡ imports ´C¡
> 
> while a third XML parser does not require statement (4).  I thought
> that because ´A¡ includes ´B¡ which already imports ´C¡, I am not
> required to re-import ´C¡ in ´A.¡

The 'import' element in XML Schema has two effects.

(1) In a schema document, it signals that references
may be made in that schema document to components 
in the imported namespace (i.e. such reference are
not necessarily typos).

(2) It suggests to the schema processor that a
complete validation of documents is likely to 
require components from the imported namespace.
Depending on how the processor goes about seeking
components from a given namespace, an import
element may lead the processor to dereference the
URI given in the schemaLocation attribute; the
attribute is only a hint, though, and some
processors allow the user to say "Get components
from here and here, do not trust other locations".

The signal that references to components in 
another namespace may be made (function 1) is 
specific to the schema document, so I believe 
the processors you work with are right to 
require statement (4).

(I haven't run samples, and I haven't cited
chapter and verse from the XSD 1.0 spec, so
take this with a grain of salt.  I hope it
helps nevertheless.)

-C. M. Sperberg-McQueen
 World Wide Web Consortium

Received on Wednesday, 23 March 2005 01:46:47 UTC