Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Another multi-field key question

From: "Jim Stanley" <JimS@--------------.--->
To: <xmlschema-dev@--.--->
Date: 12/13/2004 7:09:00 AM
Just when I think I understand all this key/keyref stuff, another
conundrum arises:

I have "categories" under my root, each with one or more "property
definitions" consisting of name-value pairs.   Several of my categories
have duplicate property definitions, something like below:

<root>
  <category>
    <name>Foo</name>
    <propDef>
        <name>Color</name>
        <type>integer</type>
    </propDef>
    <propDef>
      <name>Flavor</name>
      <type>String</type>
    </propDef>
  <category>
  <category>
    <name>Bar</name>
    <propDef>
      <name>Color</name>
      <type>integer</type>
    </propDef
    <propDef>
      <name>Odor</name>
      <type>String</type>
    </propDef>
  </category>
</root>

If I define a primary key as follows:

<xs:key name="catElem.PK">
  <xs:selector xpath="category/propDef"/>
  <xs:field xpath="name"/>
</xs:key>

XMLSpy tells me that the duplicate value "Color" has been already
matched by the identity constraint.  If I configure it like so:

<xs:key name="catElem.PK">
  <xs:selector xpath="category"/>
  <xs:field xpath="propDef/name"/>
</xs:key>

it tells me that the field "propDef/name" matches twice within the
scope of element 'category'.

I don't get this.  I thought after the last go-round that using just
'category' as the field selector created an automatic unique constraint
per category.  I need to make sure that the combination of category name
*plus* propDef/name (Foo + Color) is unique.  Can someone shed some
light (again?)

Thanks

Jim Stanley
Media Services, Inc.



    

From K.Buchcik@4... Tue Dec 14 11:32:58 2004
Received: from bart.w3.org ([128.30.5


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent