RE: schema composition questions

You've asked a lot here.  See my comments inline.
Cheers,
Paul Kiel


=====================================================
W. Paul Kiel
xmlHelpline.com Consulting
paul@xmlhelpline.com
work: 919-846-0224
cell: 919-449-8801
website: http://www.xmlhelpline.com
Your helpline for Xml, Xslt, and data integration solutions.
=====================================================

-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Shlomo Yona
Sent: Wednesday, July 04, 2007 1:43 AM
To: xmlschema-dev@w3.org
Subject: schema composition questions


Hello,

xsd:import and xsd:include seem straightforward to me until a mix of the
two is used and a "pipeline" of includes and imports is involved. I'd
like to ask a few questions to get things right:

Question #1:

Schema document A has target namespace "A", and contains top level names
"a1","a2",...,"aN".
Schema document B has no target namespace, and contains top level names
"b1","b2",...,"bN".
Schema document C has target namespace "C", and contains top level names
"c1","c2",...,"cN".

A includes B which imports C.

The composed Schema ABC now contains
	A:a1, A:a2, ..., A:aN
	A:b1, A:b2, ..., A:bN
	C:c1, C:c2, ..., C:cN

or is this situation illegal as include should not add new namespaces?!

>>Paul: this is certainly legal and useful. It is called "namespace
coercion" because you are coercing the schema B into the namespace A.  But
if the nesting gets more complicated it sometimes is not exactly
interoperable across implementations.  We ran into trouble using this some
time ago.

Question #2:

Does the order in which xsd:import and xsd:include are being processed
have any significance in a schema document?
I mean, is processing
	<xsd:include schemaLocation="foo"/>
	<xsd:import schemaLocation="bar"/>
	<xsd:include schemaLocation="baz"/>
Always the same (from the perspective of the composed schemas at the end
of the process of composing the schemas) as 
	<xsd:include schemaLocation="baz"/>
	<xsd:include schemaLocation="foo"/>
	<xsd:import schemaLocation="bar"/>
or
	<xsd:include schemaLocation="baz"/>
	<xsd:import schemaLocation="bar"/>
	<xsd:include schemaLocation="foo"/>
Or some other ordering?

>>Paul:  The ordering is not significant here.

Question #3:

What is the correct or desired order of composing schemas when there is
more than one schema document that imports/includes some other schema
document?  Should the composition process start with the inner-most
schema document? Or should it start from the outer-most schema document?
Should this matter at all? (I vote for inner-most, but I don't know...)

If FOO schema document includes BAR schema document and BAR includes the
BAZ schema document. BAZ has no target namespace and it has a ref to a
name in BAR and a ref to a name in FOO. Is this OK? Should resolution of
names take place only when all documents are "available" and "visible"
or can the resolution process take place in phases and how?

>>Paul: This is where interoperability can be a problem.  I would suggest
that you keep it to one no-ns schema being included into one ns schema.  If
you have multiple levels of includes and multiple levels of "coercion" then
tools can interpret that differently.  To be frank, we ran into problems
with namespace coercion and decided to abandon it altogether.  

Question #4:

What happens when the dependency graph of include/import of schema
documents contains circles? In this case, how does one know how deep to
go?


X <- Y <- Z <- W
And
W <- Z <- X
And
W <- Y

Every arrow (<-) means that the schema document on the left side
imports/includes the document on the right side.

It seems to me that depending on the operation, xsd:import or
xsd:include, some circles in the dependency graph should be easy to
resolve and some might be illegal. But what's the rule?

>>Paul: There is not a problem with circular includes per se.  Namespaces
aside, the spec says that duplicative includes/imports should be ignored.
So just being circular is not an error.  Now with namespaces, you are better
off avoiding this kind of behaviour because tools may interpret it
differently.


Question #5:

What is the coverage of xsd:any with regards to schema composition?

While I understand that namespace="##local" refers to the same schema
document (file) if it has no target namespace (is this correct?), what's
the scope about the other alternatives? Is the scope of the xsd:any
determined only once all schema documents are available and visible?

>>Paul: not sure I understand here.  If it is about coercion of the
namespace of the any, then I refer to earlier comments.  If it is about what
other options are available for namespace declaration of any, then there are
options such as "##other" for specifying a different namespace, "##any" for
any namespace, and there are some others too.  The spec lists them.


Thanks.

Shlomo.

Received on Friday, 6 July 2007 21:12:51 UTC