Puzzle on keyref definition

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 UTC