Dataset Internationalization Problem

Hi,
My application writes out an XML result file with an embedded schema that can later be opened
by another part of the application that renders the data in a chart and grid. It works great
using the US regional setting in WinXP. A customer of ours in Norway gets an exception when
the data is read in. The code to read the XML is this:


DataSet ds =new DataSet();
ds.ReadXml(fileName, XmlReadModel.ReadSchema);


The XML that is being read is:
<?xml version="1.0" encoding="utf-8"?>
<Results>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Snapshot">
<xs:complexType>
<xs:sequence>
<xs:element name="Item">
<xs:complexType>
<xs:attribute name="Value0" type="xs:double" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Value0" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>
<Snapshot Value0="number">
<Item Value0="0" />
<Item Value0="1" />
<Item Value0="0,248668584157093" />
</Snapshot>
</Results>

The last Item element is a double, in the "Norwegian (Nynorsk)", setting
the decimal place is a comma. Any ideas how to get this to read properly?

Thanks,
Jake
Pearson

[2020 byte] By [JakePearson] at [2008-1-21]
# 1
The datatypes in XML should be written in using CultureInfo.InstalledUICulture so that the XML can be consumed globally, so there should not be a "," in the decimal number. Use XmlConvert.ToString(decimal value); to get the write XML format.
ChrisLovett at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified