Re: Is schemaLocation just a hint in schema import?

> Does it mean that you can't have 2 schemas defining different  
> elements for
> the same namespace and then import both from another schema?

Not reliably, anyway. For a given schema usage, there is one schema  
for a given namespace URI. A "schema document" is different from a  
"schema". From the XML Schema perspective, a schema is roughly a set  
of schema components all having the same namespace URI.

> Should everything for a given schema be defined in just one schema  
> file? If
> you have a big schema definition for different functional areas, it  
> might be
> useful to split the schema in several files so you don't need to  
> import
> elements that you won't be using.

There may be multiple schema documents used to create a schema;  
however, you can only reliably import a schema using a single  
location. Instead, you should build a grouping schema document that  
<xs:include>s the other schema documents that are in the same  
namespace and then import the schema using the location of the  
grouping schema document.

> Can anybody tell me the motivation for this note in the schema spec?

To allow maximum flexibility in schema processors. For instance, to  
allow a processor to keep known schemas in a cache, while ignoring  
the location hint altogether. However, this flexibility can lead to  
other problems, for instance, in the presence of multiple versions of  
the same schema.

xan

Received on Monday, 9 October 2006 16:14:12 UTC