W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: keyRef scope and Xerces Parser !?

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed, 27 Jun 2001 11:13:18 +0200
Message-ID: <3B39A3AE.509AF38B@dyomedea.com>
To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
Cc: Uwe Zeise <uwezeise@yahoo.de>, xmlschema-dev@w3.org

"Henry S. Thompson" wrote:
> I'm not sure.  Just to make sure, simply observe that the following
> structure can be captured by key/keyref, with no necessity for them to
> be declared on the same domain:
> <company>
>  <division>
>    <section>
>       <employee role='r1'>...</employee>
>       <employee role='r2'>...</employee>
>       <employee role='r3'>...</employee>
>       <employee role='r4'>...</employee>
>    </section>
>    <section>
>       <employee role='r1'>...</employee>
>       <employee role='r2'>...</employee>
>       <employee role='r4'>...</employee>
>       <employee role='r6'>...</employee>
>    </section>
>    <section>
>       <employee role='r5'>...</employee>
>       <employee role='r2'>...</employee>
>       <employee role='r7'>...</employee>
>       <employee role='r6'>...</employee>
>    </section>
>    . . .
>    <committees>
>      <committee>
>       <member ref='r3'/>
>       . . .
>      </committee>
>      . . .
>     </committees>
>   </division>
>   . . .
> </company>
> Here we could have a unique decl on <section> wrt employees by roles,
> and a keyref decl on <division> wrt members by ref, using that unique.
> The difference between the simple case where the two share scope and
> this case is that in the first a failure always means a missing key,
> and the latter it may mean a missing key, _or_ multiple occurrences of
> a key.

My understanding was that this wasn't supported.

I have tried to implement this one with XSV, and I have defined on

<xs:unique name="section">
  <xs:selector xpath="employee"/>
  <xs:field xpath="@role"/>

and on <division>

<xs:keyref name="division" refer="section">
  <xs:selector xpath="committees/committee/member"/>
  <xs:field xpath="@role"/>

and XSV (1.2) does complain:

<?xml version='1.0'?>
<xsv docElt='{None}company' instanceAssessed='true' instanceErrors='1'
'[Anonymous]' schemaDocs='company.xsd' schemaErrors='0' schemaLocs=''
le:/C:/Java/tests/company.xml' validation='strict' version='XSV
1.190/1.95 of 20
01/05/07 08:38:12' xmlns='http://www.w3.org/2000/05/xsv'>
<invalid char='3' code='cvc-identity-constraint.2.3.2' line='3'
C:/Java/tests/company.xml'>No key or unique constraint named section
declared, r
efed by keyref division</invalid>

I tend to find it conform to the rec [1]:

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].


which let me think that the node table for the referenced key needs to
be in this same element information item.

OTH, this part is really hard to read and I might be wrong!



> ht
> --
>   Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
>           W3C Fellow 1999--2001, part-time member of W3C Team
>      2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
>             Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
>                      URL: http://www.ltg.ed.ac.uk/~ht/

Pour y voir plus clair dans la nebuleuse XML...
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
Received on Wednesday, 27 June 2001 05:14:47 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC