dotnet xml:
[quoted text, click to view] "Vyacheslav Lanovets" <xentrax_umail_ru> wrote in message news:%23IaA5VBGFHA.3120@TK2MSFTNGP12.phx.gbl...
> Is it possible to change parameters of locale for writing XML file
> (with XMLTextWriter)?
XmlTextWriter produces data representations that are formatted
using the invariant culture.
The XML Schema Datatypes W3C recommendation, which an
ADO.NET DataSet depends on to represent strongly-typed data
in XML, specifies in Section 3.2.3.1 that the lexical representation
of a decimal datatype must use the period as it's decimal separator.
http://www.w3.org/TR/xmlschema-2/#decimal Section 3.2.5.1 indicates that the lexical representation of a double
datatype must represent it's mantissa and exponent as decimals,
http://www.w3.org/TR/xmlschema-2/#double The lexical representations for these datatypes are consistent with
ISO 11404 which covers how numeric data (for instance) should
be represented to prevent ambiguities introduced by the data when
it is going to be consumed within different cultural contexts.
[quoted text, click to view] > I want DataSet.WriteXML() to use NumberDecimalSeparator "."
> instead of ","
Here is why that's a bad idea. Suppose you're serializing a decimal
value of 2.501 into XML using a different decimal separator. If
you serialize in a culture where the decimal separator is "," and the
thousands separator is "." then this lexical representation actually
represents the number two thousand five hundred one.
However, when that value gets read later in a culture where the
decimal separator is "." and the thousands separator is "," it gets
interpretted as two and five hundred one thousandths.
I hope that code isn't responsible for air traffic control. :-)
Heathrow - Charlie 9-9-9 we're turning you over to Laguardia
air traffic control. You're showing an altitude of 2,501 meters.
Over.
Laguardia - Flight Charlie 9-9-9, this is Laguardia flight tower in
New York. We see that your altitude is 2 1/2 feet. Is something
wrong? Over.
If you're going to be displaying this to the end user (as opposed to
performing further processing on it as a double or decimal datatype)
then this formatted lexical representation should be typed as a string.
That is, you should make the column a string and format it before
serializing to XML.
Derek Harmon