Subject: | fractionDigits |
(I'm not sure if this is a bug or not because I can't decipher what the Schema spec means.)
I'm using a schema which defines the following element with a fractionalDigits facet:
<xs:simpleType name="Money">
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="3"/>
</xs:restriction>
</xs:simpleType>
When using a WRITER, it turns '123.00' into '123.000'. A colleague believes that this should
be interpreted as "up to x digits", while the current X::C implementation is saying "must have
x digits". Which is correct? I can't figure out what the spec is trying to say!
The bit of the spec is:
"[Definition:] fractionDigits controls the size of the minimum difference between values in
the ·value space· of datatypes ·derived· from decimal, by restricting the ·value space· to
numbers that are expressible as i × 10^-n where i and n are integers and 0 <= n <=
fractionDigits. The value of fractionDigits ·must· be a nonNegativeInteger.
The term fractionDigits is chosen to reflect the fact that it restricts the ·value space· to those
values that can be represented lexically using at most fractionDigits to the right of the
decimal point. Note that it does not restrict the ·lexical space· directly; a non-·canonical
lexical representation· that adds additional leading zero digits or trailing fractional zero
digits is still permitted."