W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2001

Puzzle on keyref definition

From: Zhangxiangli <xianglizhang@precomtech.com>
Date: Fri, 14 Dec 2001 19:05:50 -0000
Message-ID: <00e801c1848f$4bc81c80$7f00a8c0@xianglizhang>
To: <www-xml-schema-comments@w3.org>

I currently have some puzzles on the keyref definition according to the recommendation pulished in 2 May 2001 .

I write a schema that has 6 complexType A B1 B2 C D E,  B1,B2 extension A, and C,D extension B1, class A,B1 are abstract type, and I create two element: A and E. as following:

    |      |            E
    B1    B2        
  |    |
  C    D

Here is my problem:

I want to create a keyref that reference parts of A's instance, suppose only for instance of B1 subtree, not for B2?

I think the definition should be somthing like:

    <xsd:key name="A_PK">
        <xsd:selector xpath="A[@xsi:type='C'|@xsi:type='D']"/>
        <xsd:field xpath="a1"/>
    <xsd:keyref name='E_FK" refer="A_PK">
        <xsd:selector xpath="E"/>
        <xsd:field xpath="a1"/>

but according to recomendation, in "selector" "xpath" condition expression such as"[]" does not supported, How can I write such keyref constraints?

Hope for your reply.

My sample schema and xml document is in the attachment.

bests regards.

thanks a lot.

xiangli zhang


Received on Friday, 14 December 2001 05:48:17 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:57 UTC