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

RE: key/keyref problem

From: Jun Wang <t-junw@microsoft.com>
Date: Wed, 22 Aug 2001 11:17:14 -0700
Message-ID: <DD1941DB0CCC20499A67B59B154C6860022A1427@red-msg-02.redmond.corp.microsoft.com>
To: <ht@cogsci.ed.ac.uk>, "Aung Aung" <aaung@microsoft.com>
Cc: <xmlschema-dev@w3.org>
 
Hi Henry,
 
Could you give out some comments according to some skipped parts in
Aung's emails?
 
Part I :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aung:
>> B:  (this is what you and Eric come agreeement on how it should work,
 
>> if that is the case, how do you defind the scopeof
>> the key 'B'? it cannot be all the way to the root element, can it? ) 
>> <root> <element name="a">
>>    <keyref   refer="B">
>>    <element name="b">
>>         <key   name="B">
>>    </element>
>> </element>
>> </root>
 
Priscilla:
>The scope of the key 'B' is the element 'b'.  All values of the
field(s) have to be unique within an instance of 'b'.
 
Aung:
1. If scope of the key 'B' is the element 'b', then how can the <keyref
refer="B">, which is outside of scope of element 'b', see the <key
name="B"> ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
I have the same question as Aung.  And if you can give out some specific
example or issue in Databases area which brings you to think
IDConstraint should be implemented this way, our understanding will be
even clearer...
 
Part II: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aung:
>> How about this: should this work? (how/why?)
>> C:
>> <root>
>> <element name="a">
>>         <key   name="A">
>> </element>
>> <element name="b">
>>         <keyref   refer="A">
>> </element>
>> </root>
 
Priscilla:
> No, because the key and keyref have to be defined in the same element,
or
the key has to be defined in a child element.  Neither is the case here.
 
Aung:
OK, simply put, we agree with 2 easy cases, lets put it here ...
case 2. if key and keyref are declared in different scope it, should
fail.
<r>
    <a>
        key=1
    </a>
    <b>
        keyref=1    
    </b>
</r>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Just try to understand the point clear: I think the declaration (schema)
above has nothing wrong, because maybe you have another element "c"
which has child element or is substitute group as element "a" or "b",
and make them suddenly conformance to the scope requirement of
key/keyref, so there might exist instance (xml) which is valid.  In
anther word, Aung's xml file (case 2) is definitely invalid, since
keyref can't find any key in scope, but the schema is still valid.  Do
you agree with me?  Or what's your opinion upon this?
 
Many thanks,
Jun
 
Received on Wednesday, 22 August 2001 14:17:49 GMT

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