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>
Hello:

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:

        A
        |
     ------
    |      |            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:key>
    <xsd:keyref name='E_FK" refer="A_PK">
        <xsd:selector xpath="E"/>
        <xsd:field xpath="a1"/>
    </xsd:keyref>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:57 GMT