You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mark Brucks <br...@charter.net> on 2009/09/10 01:03:53 UTC

key/keyref - valid values

I want to know what the legal values are (the key values) that are  
valid for a given keyref that references said key.  I haven't been  
able to find any methods in the DOM or the Schema interfaces that  
could be combined to derive the answer.  And since the answer depends  
on info from both the schema and the document instance, I suspect  
there are no existing methods.  So my next question...

Is there any document that explains key/keyref in more detail?   
Actually, what I would prefer is something that falls between the  
complexity of "XML Schema Part 0 - Primer" and "XML Schema Part 1 -  
Structures".  Despite the huge conceptual gap between those two  
documents, both have key/keyref examples that are simple - both the  
key and keyref are defined on the same element, and that element is  
always the root node.  From my initial reading of Part 1, the keys  
must be defined on self-or-descendant modes of the keyrefs.  But it  
doesn't explain any required relationship between the target node sets  
(qualified node sets) of the key and keyref.  I still don't  
understand, in the general case, how to determine the context node  
used for evaluation of the key selector xpath.

Any help, whether pointers to existing xerces methods or  
recommendations for other documentation to read would be appreciated.

Thanks - Mark Brucks


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: key/keyref - valid values

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Mark,

Mark Brucks <br...@charter.net> wrote on 09/09/2009 07:03:53 PM:

> I want to know what the legal values are (the key values) that are
> valid for a given keyref that references said key.  I haven't been
> able to find any methods in the DOM or the Schema interfaces that
> could be combined to derive the answer.

Right. Xerces has no such API. I don't know of any API which exposes this
information.

> And since the answer depends
> on info from both the schema and the document instance, I suspect
> there are no existing methods.  So my next question...
>
> Is there any document that explains key/keyref in more detail?

Aside from the spec? :-) There are some tutorials and presentations [1]
referenced from the W3C website that you may find useful. I've never looked
at them though.

> Actually, what I would prefer is something that falls between the
> complexity of "XML Schema Part 0 - Primer" and "XML Schema Part 1 -
> Structures".  Despite the huge conceptual gap between those two
> documents, both have key/keyref examples that are simple - both the
> key and keyref are defined on the same element, and that element is
> always the root node.  From my initial reading of Part 1, the keys
> must be defined on self-or-descendant modes of the keyrefs.  But it
> doesn't explain any required relationship between the target node sets
> (qualified node sets) of the key and keyref.

It's defined in the spec [2][3] though admittedly challenging to decipher
and not easily explained in plain English.

> I still don't understand, in the general case, how to determine
> the context node used for evaluation of the key selector xpath.

The context node for a selector XPath is each element node in the instance
whose corresponding element declaration contains the identity constraint
with that selector XPath.

> Any help, whether pointers to existing xerces methods or
> recommendations for other documentation to read would be appreciated.
>
> Thanks - Mark Brucks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Thanks.

[1] http://www.w3.org/XML/Schema#usage
[2] http://www.w3.org/TR/xmlschema-1/#cl-krv
[3] http://www.w3.org/TR/xmlschema-1/#sic-key

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org