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

Specifying integrity constraints on type

From: Guillaume Rousse <rousse@ccr.jussieu.fr>
Date: Fri, 24 Aug 2001 12:16:15 +0200
To: xmlschema-dev@w3.org
Message-Id: <20010824101615.9300F2C77@silbermann.snv.jussieu.fr>
I got some problems defining correct xpath expression for some identity 
constraints in a XML schema, where the enclosing element name is not 

I have a generic EventType type:
<complexType name="EventType" abstract="yes">
    <element name="author" minOccurs="1" maxOccurs="unbounded">
        <attribute name="idref" type="string" use="required"/>

I want to ensure an author could only be a person, so i have a key for 
persons defined in my root element:
<key name="personKey">
  <selector xpath="persons/person"/>
  <field xpath="@id"/>

And the corresponding keyref will be something as:
<keyref name="eventAuthor" refer="personKey">
  <selector xpath="?"/>
  <field xpath="@idref"/>

But now, how must i define the xpath attribute for the selector element, so 
as to match only author element from an event type ? As this last one is a 
type, it can occurs with arbitrary name (aka identification, observation, 

Auxiliary question: key definition make key field mandatory. Does keyref 
definition makes keyref fields mandatory also ?
Guillaume Rousse <rousse@ccr.jussieu.fr>
GPG key http://bohm.snv.jussieu.fr/~rousse/gpgkey.html
Received on Friday, 24 August 2001 06:17:23 UTC

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