Re: keyRef scope and Xerces Parser !?

"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
<section>:

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

and on <division>

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

and XSV (1.2) does complain:

<?xml version='1.0'?>
<xsv docElt='{None}company' instanceAssessed='true' instanceErrors='1'
rootType=
'[Anonymous]' schemaDocs='company.xsd' schemaErrors='0' schemaLocs=''
target='fi
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'
resource='file:/
C:/Java/tests/company.xml'>No key or unique constraint named section
declared, r
efed by keyref division</invalid>
</xsv>

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

[1]
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Identity-constraint-Definition-Information-Set-Contributions

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!

Thanks

Eric

> 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...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
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