W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2013

Re: XML Datatype clarification: fractionDigits

From: Michael Kay <mike@saxonica.com>
Date: Tue, 25 Jun 2013 16:15:18 +0100
Cc: Nochum Klein <nklein@tibco.com>, "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-Id: <0B437C63-BE81-400D-BD9E-1DFAA540F044@saxonica.com>
To: Mukul Gandhi <gandhi.mukul@gmail.com>
Yes. 4.3.12 says

[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. 

so setting fractionDigits restricts the value space to integer multiples of 1x10^0, i.e. to whole numbers. The value 12 can still be written as 12.0. This is not the same as xs:integer, because xs:integer also restricts the lexical space.

Michael Kay
Saxonica 

On 25 Jun 2013, at 15:45, Mukul Gandhi wrote:

> On Fri, Jun 21, 2013 at 11:35 PM, Nochum Klein <nklein@tibco.com> wrote:
>> I was hoping to get some clarification regarding the use of
>> <xsd:fractionDigits value="0"/>.
> 
> I think, doing this on xsd:decimal is perhaps equivalent to using xsd:integer.
> 
>> My understanding of the specification is that there must be at most the number of specified digits.
> 
> I agree. Thats what I can understand from spec also.
> 
>> Therefore if it's zero then there MUST be zero digits (and "1..0" should be represented as
>> "1").  Where the fractionDigits is set to zero, the resulting value can only
>> be supported in a lexical representation of the "xsd:decimal" data type
>> (e.g. 1), but not the canonical one (which requires 1.0).  I understand that
>> the spec addresses this with lexical-canonical mappings.  However assume
>> that a WSDL contains a restriction for zero fractionDigits.  If a value of
>> "1.0" is input, should the input be rejected as it is incompatible with the
>> restriction, or should it be accepted since there is a valid mapping to a
>> canonical representation that would be compatible with the restriction?
> 
> The spec of xsd:fractionDigits says, "it does not restrict the
> ·lexical space· directly; a lexical representation that adds
> non-significant leading or trailing zero digits is still permitted.".
> My reading of this says, if an input value is 1.0 and
> xsd:fractionDigits value="0" then this value would be reported as
> valid, since in this case trailing zero was removed and than
> validation was done.
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
Received on Tuesday, 25 June 2013 15:15:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:22 UTC