W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

representing fixed point decimal types

From: Cole, Russ E <Russ.Cole@unisys.com>
Date: Wed, 1 May 2002 10:46:01 -0500
Message-ID: <ABC8C2B0E4A1CA47B79A03B1E939BFEA01176710@USMV-EXCH3.na.uis.unisys.com>
To: xmlschema-dev@w3.org
Am I right that there are no fixed point types in xml schema?  The closest
thing I can find to precision/scale is totalDigits/fractionDigits.  So, I
find myself using minInclusive/maxInclusive.  For example, for precision 8
scale 2:

              <xs:restriction base='xs:decimal'>
               <xs:totalDigits value='8'/>
               <xs:fractionDigits value='2'/>
               <xs:minInclusive value='-999999.99'/>
               <xs:maxInclusive value='999999.99'/>

Also, the example in the xml schema standard seems wrong to me because it
says using totalDigits 8 and fractionDigits 2 constrains the value to be
less than 1 million whereas it only constrains the value to be less than 100

Russ Cole


The following is the definition of a ·user-derived· datatype which could be
used to represent monetary amounts, such as in a financial management
application which does not have figures of $1M or more and only allows whole
cents. This definition would appear in a schema authored by an "end-user"
and shows how to define a datatype by specifying facet values which
constrain the range of the ·base type· in a manner specific to the ·base
type· (different than specifying max/min values as before). 
<simpleType name='amount'>
  <restriction base='decimal'>
    <totalDigits value='8'/>
    <fractionDigits value='2' fixed='true'/>
Received on Wednesday, 1 May 2002 11:46:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:01 UTC