[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using substitution groups as meta-types

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 8 Nov 2001 16:51:31 +0000
Message-ID: <122507273.20011108165131@jenitennison.com>
To: Mark Feblowitz <mfeblowitz@frictionless.com>
CC: "Xmlschema-Dev (E-mail)" <xmlschema-dev@w3.org>
using substitution group in xsd
Hi Mark,

> 1. should schema validators reject any "Phrase" specialization that
> contains a Verb child or Object child that is not a member of its
> respective substitution group?

It would make sense, and after going through
http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict in detail, I'm
fairly sure the answer is yes.

The Phrase type is the sequence of a single Verb element followed by a
single Object element. Valid restrictions of this sequence are either
single element particles or other sequences. If it's an element
particle, then it's mapped on to a sequence for the purpose of
validation.

So now we're comparing the base sequence and the derived sequence.
Each of the particles in the derived sequence must map to one of the
particles in the base sequence, preserving order and not skipping any
of the non-emptiable particles in the base sequence. So the derived
sequence must contain one particle that maps on to the Verb element
particle and another particle that maps on to the Object element
particle.

Because they're heads of substitution groups, the Verb and Object
element particles are mapped onto a choice element, containing the
members of the substitution group of which they are the heads. When
comparing a choice to an element, the element is placed in a choice
and the choices are compared.

When comparing two choices, each of the particles in the derived
choice must map on to one of the particles in the base choice. That
will only happen if the base choice (i.e. the choice created from the
element particle due to it being the head of a substitution group)
contains an element particle contained in the derived choice (i.e. the
element declared).

So the only legal derivations of the Phrase type are those that
contain two element particles, the first of which is the Verb element
or one of its substitution group memebers, and the second of which is
the Object element or one of its substition group members.

> 2. should schema validators reject an instance document containing a
> specific phrase element that names a Verb child or Object child that
> is not a member of its respective substitution group?

Again, it would make sense and after going through
http://www.w3.org/TR/xmlschema-1/#cvc-particle I'm fairly sure the
answer is yes.

To be valid, the content of the element that has the Phrase type must
consist of a sequence of elements that are valid against the sequence
defined for the Phrase type (of a single Verb element followed by a
single Object element).

The first element must be locally valid against the (global)
declaration of the Verb element. This can only happen if the name of
the element is 'Verb' or if the (global) declaration of the element is
validly substitutable for the Verb element's declaration. This only
happens if the element's declaration is (eventually) affiliated with
the substitution group of which Verb is the head.

Similarly for Object.

> 3. By using these constructs "at the metalevel", am I using the
> substitution group mechanism in a way that is not intended to be
> used?

I don't think so - it seems like a reasonable use to me.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 8 November 2001 11:51:34 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.