I know! But the problem isn't the parser, it's the XmlSchema 'compliant' XmlConvert.ToString(decimal) function. I thought the whole point of the XmlConvert class was to provide XmlSchema compliant conversion functions.
And as such, the XmlConvert.ToString(decimal) shouldn't write the exponential format in the first place... Am I wrong ? Morty -----Original Message----- From: Richard Birkby [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 12:47 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] XmlConvert and Decimal bug The conversion calls dec=Decimal.Parse("5E-05", NumberStyles.AllowLeadingSign| NumberStyles.AllowDecimalPoint| NumberStyles.AllowLeadingWhite| NumberStyles.AllowTrailingWhite, NumberFormatInfo.InvariantInfo); which calls into native code via the Number class. It specifically disallows the NumberStyles.AllowExponent bitfield because the XML Schema datatypes spec does not allow exponents for Decimal types. http://www.w3.org/TR/xmlschema-2/#decimal The spec allows up to 18 digits and no exponent. Richard > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf > Of Morten Abrahamsen > Sent: 31 May 2002 11:16 > To: [EMAIL PROTECTED] > Subject: [DOTNET] XmlConvert and Decimal bug > > > One would assume that the following would work: > > string decimalString = XmlConvert.ToString(0.00005M); > decimal dec = XmlConvert.ToDecimal(decimalString); > > However it throws a FormatException because the string conversion > results in an exponential format, which isn't permitted in the > ToDecimal parser. > > Is this a common bug, or is this related to some strange locale > settings... (it should be schema compliant and locale invariant > though..) > > Any thoughts ? > > Morty > > You can read messages from the DOTNET archive, unsubscribe from > DOTNET, or subscribe to other DevelopMentor lists at > http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.