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

Re: keyRef scope and Xerces Parser !?

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 27 Jun 2001 09:26:47 +0100
To: vdv@dyomedea.com
Cc: Uwe Zeise <uwezeise@yahoo.de>, xmlschema-dev@w3.org
Message-ID: <f5b8ziefhvc.fsf@cogsci.ed.ac.uk>
Eric van der Vlist <vdv@dyomedea.com> writes:

> "Henry S. Thompson" wrote:
> > 
> > Eric van der Vlist <vdv@dyomedea.com> writes:
> > 
> > > It means that a xs:unique or xs:key and its corresponding xs:keyref need
> > > to be defined in the same element (the tables storing the values are
> > > local to this element).
> > 
> > Not quite -- simply that the scoping element for the key/unique must
> > be the same as or occur (in the instance) within the scoping element
> > for the keyref.
> 
> I think that it's what I meant ;=) ...
> 
> I should have said "scoping element" rather than "element", but my
> understanding is that the PSVI key/keyref tables are both local to the
> scoping element and that, therefore, the matching between key/unique and
> keyref can only be done at this location.
> 
> This is one of the differences with ID/IDREF which tables are local to
> the root of the document (the nearest that can be achieved with
> key/keyref is to use the document element like shown in this example).
> 
> Am I wrong?

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.

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/
Received on Wednesday, 27 June 2001 04:26:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT