- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 1 May 2002 19:50:08 +0100
- To: "Cole, Russ E" <Russ.Cole@unisys.com>
- CC: xmlschema-dev@w3.org
Hi Russ, > 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:simpleType> > <xs:restriction base='xs:decimal'> > <xs:totalDigits value='8'/> > <xs:fractionDigits value='2'/> > <xs:minInclusive value='-999999.99'/> > <xs:maxInclusive value='999999.99'/> > </xs:restriction> > </xs:simpleType> Another method that you could use is to use a pattern to say that you want exactly two decimal digits: <xs:simpleType> <xs:restriction base="xs:decimal"> <xs:totalDigits value="8" /> <xs:fractionDigits value="2" /> <xs:pattern value="-?\d{1,6}\.\d{2}" /> </xs:restriction> </xs:simpleType> The pattern allows an optional minus sign, followed by between 1 and 6 digits, followed by a decimal point, followed by two digits. > 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 million. I think that's already been noted. See http://www.w3.org/2001/05/xmlschema-rec-comments#pfiTotalDigits Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Wednesday, 1 May 2002 14:50:11 UTC