keyref attributes are mandatory?

Discussion in 'XML' started by mark.van.der.voort@gmail.com, Mar 3, 2005.

  1. Guest

    Hi,

    I have defined a simple key/keyref validation for describing a tree.

    <xs:key name="key_member">
    <xs:selector xpath=".//member"/>
    <xs:field xpath="@id"/>
    </xs:key>
    <xs:keyref name="ref_parent_member" refer="key_member">
    <xs:selector xpath=".//member"/>
    <xs:field xpath="@parentid"/>
    </xs:keyref>

    However, the parentid attribute is not mandatory, hence top-level
    elements will not specify a parentid attribute.

    This combination worked fine in XMLSPY 2004, but the exact same files
    give the following error message in XMLSY 2005:

    "The <keyref> identity constraint ... did not match any elements"

    It disappears when at least one element has a parentid attribute.
    Is it correct that a keyref constraint implies that at least one
    attribute exists, and if so how would one specify a multirooted tree?

    thx,

    Mark van der Voort
     
    , Mar 3, 2005
    #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. Marek Malowidzki

    Key/keyref validation in schema?

    Marek Malowidzki, Aug 18, 2003, in forum: XML
    Replies:
    1
    Views:
    522
    Mark Preston
    Aug 19, 2003
  2. J E E
    Replies:
    0
    Views:
    385
    J E E
    Nov 7, 2003
  3. peterpeter
    Replies:
    0
    Views:
    947
    peterpeter
    Feb 11, 2004
  4. Markus Seibold

    <key><keyref> does not work in XMLSpy

    Markus Seibold, Feb 13, 2004, in forum: XML
    Replies:
    0
    Views:
    1,328
    Markus Seibold
    Feb 13, 2004
  5. Russell O'Connor

    Key-keyref to attribute in root element

    Russell O'Connor, Mar 5, 2004, in forum: XML
    Replies:
    5
    Views:
    1,004
    Henry S. Thompson
    Apr 27, 2004
Loading...

Share This Page