Followup: multiple services sharing a name

Heylas,

It occurs to me that it might help to clarify this issue by offering a
sample from another domain, so long as the analogy is strong and clear.

In W3C XML Schema, one of the most often-requested features is what is
labelled as "co-occurrence constraints."  The requesters of this
functionality, on the whole, don't use this label, but the folks who
answer the FAQ use the label as a shorthand.  Briefly, the usual request
is that the content model of an element be dependent upon the value
assigned to an attribute.  This would be similar to a discriminated
union in C, for instance.  An example: based on the value of the
country-code attribute (defined to be an enumeration of ISO country
codes), the value of the child element <postal-code> should conform to
an appropriate pattern (patterns exist for US, UK, etc., etc.).

This is not permitted in W3C XML Schema.  Can't be done, is the answer.

Here's another answer, which I believe to be analogous to what David has
proposed:

Create a schema for each country code.  Give them all the same
targetNamespace.  Give each a fixed value for the country-code
attribute, and specify the content model of the appropriate country.

In fact, you could extend this a bit, since it's so useful, and make
these all schema fragments, with identical targetNamespaces, and have a
single import statement.  Since any given schema processor ultimately
resolves only *one* of these imports, it's clearly a valid and viable
workaround for this annoying restriction in WXS, which places the burden
of choosing the correct bit to import on the catalog processor.  How
this happens is not of interest to us schema folks; it's the province of
catalog designers/developers.

Roughly the same issue exists without an import, if one simply creates
multiple same-namespace schemas with different content models, varied
based on the value of this attribute.  Again, it becomes a problem not
for the schema validation engine, but for the catalog, which has to
supply the "correct" schema for a particular instance document.

This would be an interesting proposal to make to the WXS WG.  Would they
be as "neutral" to such a workaround as we have proposed to be on
multiple definitions of a service, varying on the occurrence of the
interface attribute?

Amy!
-- 
Amelia A. Lewis
Architect, TIBCO/Extensibility, Inc.
alewis@tibco.com

Received on Wednesday, 14 January 2004 15:01:53 UTC