XML schema hierarchical key constraint verfication

Discussion in 'XML' started by drmccoy@home.se, May 31, 2006.

  1. Guest

    I'm trying to create a key that verify uniqueness hierarchically. Is
    that even possible when using XML schema? So far I had no luck. XML
    example:

    <root>
    <As>
    <A id='1'>
    <Bs>
    <B id='1'/>
    <B id='2'/>
    <B id='3'/>
    </Bs>
    </A>
    <A id='2'>
    <Bs>
    <B id='1'/>
    <B id='2'/>
    <B id='3'/>
    </Bs>
    </A>
    </As>
    </root>

    B always has a parent A, therefore I'd like to have a key that
    identifies a specific B that belongs to an A.
    This construction fails to do what I want:

    <xs:unique name="Unique">
    <xs:selector xpath="As/A"/>
    <xs:field xpath="@id"/>
    <xs:field xpath="Bs/B/@id"/>
    </xs:unique>

    Any suggestions?
    , May 31, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Whitlow
    Replies:
    1
    Views:
    394
    C. M. Sperberg-McQueen
    Sep 23, 2003
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    487
    Stanimir Stamenkov
    Jan 5, 2006
  3. Replies:
    5
    Views:
    751
    Priscilla Walmsley
    Jan 16, 2006
  4. puvit82
    Replies:
    4
    Views:
    737
    puvit82
    Feb 1, 2008
  5. Replies:
    1
    Views:
    1,058
    Martin Honnen
    Sep 26, 2008
Loading...

Share This Page