- From: George Cristian Bina <george@sync.ro>
- Date: Thu, 8 Jul 2004 03:11:28 +0300
- To: "Jim Stanley" <JimS@Media-Services.Com>, <xmlschema-dev@w3.org>
Hi Jim, > Can another pair of eyes shed some light? The attached sample files > illustrate the problem. See a little below from http://www.w3.org/TR/xmlschema-1/#fields >>> {fields} specifies XPath expressions relative to each element selected by a {selector}. This must identify a single node (element or attribute) whose content or value, which must be of a simple type, is used in the constraint. <<< In your case two fields <xs:field xpath="Element/elemName"/> <xs:field xpath="elemPropertyDef/propName"/> will identify multiple nodes. Xerces will give you the following errors located on the additinal field matches: E Identity constraint error: field "./Element/elemName" matches more than one value within the scope of its selector; fields must match unique values. Test2.xml file:/D:/test/Test2.xml 20:1 E Identity constraint error: field "./elemPropertyDef/propName" matches more than one value within the scope of its selector; fields must match unique values. Test2.xml file:/D:/test/Test2.xml 35:1 E Identity constraint error: field "./elemPropertyDef/propName" matches more than one value within the scope of its selector; fields must match unique values. Test2.xml file:/D:/test/Test2.xml 39:1 A remark is that a key checks the uniqueness of the fields on the node set matched by the selector. If your selector matches one node then the key will just check that the field(s) exist. I think you actually want something like below: <xs:key name="Cat.PK1"> <xs:selector xpath="."/> <xs:field xpath="catName"/> </xs:key> <xs:key name="Elem.U1"> <xs:selector xpath="Element"/> <xs:field xpath="elemName"/> </xs:key> <xs:key name="Def.PK1"> <xs:selector xpath="elemPropertyDef"/> <xs:field xpath="propName"/> </xs:key> Hope that helps, George ------------------------------------------------------- George Cristian Bina mailto:george@oxygenxml.com <oXygen/> XML Editor & XSLT Editor/Debugger http://www.oxygenxml.com/
Received on Wednesday, 7 July 2004 20:12:53 UTC