W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Illegal use of unique? I need it. Microsoft supports it. Alternatives?

From: Gary Robertson <gazinyork@hotmail.com>
Date: Wed, 10 Oct 2001 09:01:11 -0400 (EDT)
To: <xmlschema-dev@w3.org>
Message-ID: <OE25aD8z9tTx7e4Vksa0000ab2f@hotmail.com>
I want to have a type "Object" that contains multiple "State" elements.
I want the state names to be unique within each object instance but
not globally. This is an example of a very common real world
requirement. Praise to Microsoft's MSXML4 beta 2 for letting me
achieve my aims like so:

<xs:complexType name="ObjectType">
  <xs:extension base="AbstractElementType">
      <xs:element name="State" type="StateType" minOccurs="0"
      <xs:unique name="StateNamesUniqueWithinAnObject">
      <xs:selector xpath="../State"/>
      <xs:field xpath="@name"/>

However, note use of parent node syntax (..) in the selector xpath.
Is this illegal? If so, how do I acheive my aim legally? I intend to
declare object instances at multiple points and levels in my schema
and it would be extremely onerous and poor software engineering
practice to have to attach a unique to every instance.

Received on Wednesday, 10 October 2001 10:27:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:54 UTC