This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2746 - wd-20: Identity vs. Equality in enumerations and fixed value constraints
Summary: wd-20: Identity vs. Equality in enumerations and fixed value constraints
Status: RESOLVED WONTFIX
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Datatypes: XSD Part 2 (show other bugs)
Version: 1.1 only
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-20 21:26 UTC by Mary Holstege
Modified: 2006-01-20 21:27 UTC (History)
0 users

See Also:


Attachments

Description Mary Holstege 2006-01-20 21:26:28 UTC
In the call today we decided to use identity for value constraints, just as we 
do for enumeration, on the logic that a fixed value constraint is like an 
enumeration with a single value.

Noah and I expressed a certain discomfort with identity in both these cases, 
especially with respect to precision decimal. Consider:
<xs:simpleType name="u2numbers"> <xs:restriction base="xs:precisionDecimal"> 
<xs:enumeration value="1.0"/> <xs:enumeration value="2.0"/> <xs:enumeration 
value="3.0"/> <xs:enumeration value="14.0"/> </xs:restriction> </xs:simpleType>

We accepted that "1" and "1.00" would not be valid against this enumeration on 
the grounds that enumerations of decimals were not used in practice, so this 
infelicity was unlikely to bite anyone. The work-around would be to enumerate a 
sufficient range of precisions to cover the most likely cases to turn up in 
practice:
<xs:simpleType name="u2numbers"> <xs:restriction base="xs:precisionDecimal"> 
<xs:enumeration value="1"/> <xs:enumeration value="1.0"/> <xs:enumeration 
value="1.00"/> <xs:enumeration value="2"/> <xs:enumeration value="2.0"/> <xs:
enumeration value="2.00"/> <xs:enumeration value="3"/> <xs:enumeration value="3.
0"/> <xs:enumeration value="3.00"/> <xs:enumeration value="14"/> <xs:enumeration 
value="14.0"/> <xs:enumeration value="14.00"/> </xs:restriction> </xs:
simpleType>

Painful in practice, impossible in the general case (although I suppose you 
could enumerate to the limits of precision supported by your processor, urgh.)

Or you put in a pattern facet instead, which can also be painful.

Consider this definition:
<xs:element name="meterMin" type="xs:precisionDecimal"/>

Somewhere in a content model:
<xs:element ref="meterMin" fixed="1.0"/>

In this case<meterMin>1.00</meterMin> and <meterMin>1</meterMin> would be 
rejected.

Here, however, there is no workaround that allows you the simplicity of using 
the fixed attribute: you have to change the type. If you wanted to have 
different fixed values for different uses of the element meterMin in your 
schema, you have to jump through some rather painful hoops using local 
definitions that have nasty enumerations or patterns in them: the type of each 
use of meterMin would have to be different.I still question the wisdom of using 
identity in either of these cases. Most types do not distinguish identity and 
equality, and in those cases that do, the results are unhelpful, as shown.

Request concerning
Part 1
Transition history

raised on 3 Dec 2004 by Mary Holstege (http://lists.w3.org/Archives/Public/www-
xml-schema-comments/2004OctDec/0026.html)
declined on 3 Dec 2004 (http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/
2004Dec/0002.html)

RESOLVED No consensus to change status quo.

Acknowledgment cycle
announced by group on 3 Nov 2004 (http://lists.w3.org/Archives/Member/w3c-xml-
schema-ig/2004Nov/0002.html)