- From: <neilg@ca.ibm.com>
- Date: Fri, 22 Jun 2001 17:43:55 -0400
- To: www-xml-schema-comments@w3.org
Hello,
From 3.11.4 of the Schema Structures specification we have:
Validation Rule: Identity-constraint Satisfied
4.3 If the
{identity-constraint category}
is keyref, then for each member of the
·qualified node set· (
call this the keyref member), there must be a
·node table·
associated with the
{referenced key}
in the
[identity-constraint table]
of the element information item (see
Identity-constraint Table (§3.11.5),
which must be understood as logically prior to this clause of this
constraint, below) and there must be an entry in that table whose
·key-sequence·
is equal to the keyref member's
·key-sequence·
member for member, as defined by
Equal
in
[XML Schemas: Datatypes].
In lay terms, I take this to mean that:
1. For all sequences of strings identified by the fields of a <keyref>,
there must exist a sequence of pairwise equal strings identified by the
identity constraint that the <keyref> references;
2. Let element K be an element in the instance document which is validated
by a schema declaration which contains a <keyref>. Now consider the set of
nodes S identified by applying the xpath descendant-or-self axis to K.
Then one of the nodes in S must be validated by an element declaration
containing an identity constraint which the "refer" attribute of the
<keyref> resolves to. That is to say, the identity constraint referenced
by the <keyref> must apply to the element the <keyref> is on or to one of
its descendants in a given instance document.
If the above is correct, then the following example from the beginning of
chapter 5 of the Schema Primer cannot be valid, because in any instance
document validated by this schema, the element containing the <keyref> must
occur as a descendant of the element containing the identity constraint to
which the <keyref> occurs.
<element name="purchaseReport">
<complexType>
<sequence>
<element name="regions" type="r:RegionsType">
<keyref name="dummy2" refer="r:pNumKey">
<selector xpath="r:zip/r:part"/>
<field xpath="@number"/>
</keyref>
</element>
<element name="parts" type="r:PartsType"/>
</sequence>
<attribute name="period" type="duration"/>
<attribute name="periodEnding" type="date"/>
</complexType>
<unique name="dummy1">
<selector xpath="r:regions/r:zip"/>
<field xpath="@code"/>
</unique>
<key name="pNumKey">
<selector xpath="r:parts/r:part"/>
<field xpath="@number"/>
</key>
</element>
Given the important role that the Primer plays in helping people to learn
and develop XML Schemas, if this is in fact an erratum I hope that it will
be possible to take speedy measures to make this clear to readers.
Regards,
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 416-448-3519, T/L 778-3519
E-mail: neilg@ca.ibm.com
Received on Friday, 22 June 2001 17:43:59 UTC