- From: Jim Stanley <JimS@Media-Services.Com>
- Date: Mon, 13 Dec 2004 15:09:21 -0800
- To: <xmlschema-dev@w3.org>
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.
Received on Monday, 13 December 2004 23:10:25 UTC