W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2006

Re: Is schemaLocation just a hint in schema import?

From: Xan Gregg <xan.gregg@jmp.com>
Date: Mon, 9 Oct 2006 12:14:04 -0400
Message-Id: <497410E9-11B5-42DC-8500-49895A27509A@jmp.com>
Cc: xml-dev@lists.xml.org, xmlschema-dev@w3.org
To: "Antoli, Leo" <Leo.Antoli@Misys.com>

> 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:55 GMT