- From: Michael Petres <michaelp@innovobjx.com>
- Date: Wed, 26 Sep 2001 23:28:11 -0400 (EDT)
- To: <xmlschema-dev@w3.org>
Hi, I have a broken uniqueness constraint that used to work with parser supporting the 20001014 spec. I am trying to define a uniqueness constraint for the contents of an element. I had the following schema definition working under parsers that adhered to the 20001024 spec. <xsd:element name="object_space" ....> <xsd:complexType> <xsd:sequence> ... <xsd:element name="obj" type="obj" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> ... </xsd:complexType> <xsd:unique name="unique_obj_name"> <xsd:selector xpath="obj"/> <xsd:field xpath="name"/> </xsd:unique> <xsd:complexType name="obj"> <xsd:choice minOccurs="0" maxOccurs="unbounded"> ... <xsd:element name="name" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> ... <xsd:simpleContent> <xsd:extension base="xsd:string"/> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:element> ... </element> The above definition allowed in the XML file for the specification of multiple <name>s for each <obj> as long as the contents of the <name> tag contents (name_1, name_2, ..., name_n) were unique within the <object_space>...</object_space> definition: <object_space ...> <obj> <name>name_1</name> <name>name_2</name> ... </obj> ... <obj> <name>name_n-1</name> <name>name_n</name> ... </obj> </object_space> The problem is, with parsers that adhere to later specs (e.g. 20010330) this no longer works. The schema only allows for 0..1 <name> specifications for each <obj> tag. The above xml file fails with the message: "... the fields XPath selector of the key/unique/keyref identity constraint 'unique_obj_name' must evaluate to exactly 0 or 1 nodes..." The following will work though: <object_space ...> <obj> <name>name_1</name> ... </obj> ... <obj> <name>name_n-1</name> ... </obj> </object_space> For the life of me I am unable to figure out what's out of order. I have checked the specs and I couldn't find anything to indicate this would no longer be valid... If anyone has any ideas, please help. Thanks in advance, Michael Petres ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ InnovObjX Corporation <mailto:michaelp@innovobjx.com> <http://www.innovobjx.com> Tel: 905-729-2235 ext.61, Fax:905-729-0754 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Received on Thursday, 27 September 2001 05:08:56 UTC