Search This Blog

Friday, October 26, 2007

The Trouble With XML Schema Imports and Includes

Those who have written W3C XML Schemas will know that there are two
mechanisms for sharing Schema definitions across files. "xs:include"
is used like traditional programming language 'include' statements,
so that you can split a single large file up into separate, modular
pieces. "xs:import" is used when you need to use Schema definitions
from a different XML namespace, as W3C XML Schema doesn't allow a
single Schema file to contain definitions for more than a single
namespace... I have been involved with a number of standards groups,
and I know that the what comes out of a standards effort depends on
what requirements and scope have been given to the group. So while
I wish that the W3C's XML Schema Working Group had been able to give
us something better for Schema definition sharing than just
import/include statements, I don't think the working group ever had
a scope that would have allowed them, for example, to define a
standard for repositories of Schema definitions, and for how to
compose and generate Schemas flexibly from the definitions in one or
more repositories. Instead, we have import and include, which are
about the best you can do when your scope only allows you to deal with
schemas, and not with higher-level concepts like repositories. As a
general rule, almost any solution will work if the problem is simple
enough and straightforward enough and isn't particularly demanding in
any way. Many uses of import/include statements are simple enough that
these built-in mechanisms do what is needed. However, there are
other situations where import/include don't work as you would hope,
and I thought I would mention a couple that I have run into in practice... More Information

No comments: