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>
Hello.
I got some problems defining correct xpath expression for some identity 
constraints in a XML schema, where the enclosing element name is not 
constant.

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

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"/>
</key>

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

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, 
etc...)...

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 GMT

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