W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2009

Re: [XML Schema 1.1] I need an example that illustrates the usefulness of xs:error

From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
Date: Wed, 22 Jul 2009 11:51:01 -0600
Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-Id: <CB6E9122-9098-4FD4-8B20-50129C367297@blackmesatech.com>
To: "Costello, Roger L." <costello@mitre.org>
On 22 Jul 2009, at 05:37 , Costello, Roger L. wrote:

>
> Hi Mukul,
>
> Yesterday I was talking with a colleague and I described to him  
> Conditional Type Alternative (CTA) and then xs:error. He was puzzled  
> about xs:error. He couldn't see a legitimate (nonredundant) use case  
> for it. As I got to thinking about it, I agreed with him.

Just as discussions of regular expressions and regular
languages find it helpful to have a way to write down
an expression denoting the empty set, so also it can be
convenient, in thinking about document validation, to have
a name for a type with no valid instances.  I think
xsd:error would be a convenient thing to have even if
XSD 1.1 had not adopted conditional type assignment.

Consider a practical scenario (real example, names
suppressed to avoid distractions):  project P is working with
a local specialization of a large generic vocabulary V.
P uses all of the elements defined by V as required, and
some of the elements defined by V as optional.  Some
elements which are optional in V are optional in P,
some are required in P, and others are forbidden in P.

It is not enough for project P to tell its users "Don't
use element E" -- part of checking the acceptability of
documents for project P is checking that element E
does not occur at all, even though it's optional in
the base vocabulary V.

With some validation mechanisms, such as DTDs, it suffices
to provide a way to ensure that E is not declared.  But
if the validation language includes lax wildcards, that
won't be enough.  It would be convenient for project P
to be able to declare a simple restriction of vocabulary
V by writing

   <override schemaLocation="main.path.to.V">
     <element name="E" type="error"/>
     <!--* other elements can be excluded here by the same
         * method ... *-->
   </override>

And in XSD 1.1, that can be done.

-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************
Received on Wednesday, 22 July 2009 17:51:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 22 July 2009 17:51:38 GMT