[Mono-bugs] [Bug 367333] New: XmlDataDocument formats dates incorrectly
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Mar 5 09:14:37 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=367333
Summary: XmlDataDocument formats dates incorrectly
Product: Mono: Class Libraries
Version: 1.2.6
Platform: i686
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.XML
AssignedTo: atsushi at ximian.com
ReportedBy: monobugs at peterarnold.net
QAContact: mono-bugs at lists.ximian.com
Found By: Third Party Developer/Partner
Description of Problem:
Whilst porting an ASP.NET application to Mono I discovered that XmlDataDocument
produces incorrectly formatted dates.
Steps to reproduce the problem:
I wrote this small application to reproduce the problem in a simple way:
static void Main(string[] args)
{
// Create a dataset
DataSet ds = new DataSet("TestDataSet");
ds.Tables.Add("TestDataTable");
ds.Tables[0].Columns.Add("TestColumnA",
System.Type.GetType("System.String"));
ds.Tables[0].Columns.Add("TestColumnB",
System.Type.GetType("System.DateTime"));
// Fill it will 2 rows of data
object[] rawdata = new object[2];
rawdata[0] = "Hello World!";
rawdata[1] = new System.DateTime(2008,1,1,12,13,14);
ds.Tables[0].Rows.Add(rawdata);
rawdata[0] = "Is A > B?";
rawdata[1] = new System.DateTime(2008, 2, 2, 20, 21, 22);
ds.Tables[0].Rows.Add(rawdata);
// Write the result using WriteXml
ds.WriteXml("ResultA.xml");
// Write the result using XmlDataDocument
XmlDataDocument xmldd = new XmlDataDocument(ds);
XmlTextWriter tw = new XmlTextWriter("ResultB.xml",
System.Text.UTF8Encoding.UTF8);
tw.Formatting = Formatting.Indented;
xmldd.WriteTo( tw );
tw.Flush();
}
Actual Results (run on mono 1.2.6):
Result A
<?xml version="1.0" standalone="yes"?>
<TestDataSet>
<TestDataTable>
<TestColumnA>Hello World!</TestColumnA>
<TestColumnB>2008-01-01T12:13:14.0000000</TestColumnB>
</TestDataTable>
<TestDataTable>
<TestColumnA>Is A > B?</TestColumnA>
<TestColumnB>2008-02-02T20:21:22.0000000</TestColumnB>
</TestDataTable>
</TestDataSet>
<TestDataSet>
<TestDataTable>
<TestColumnA>Hello World!</TestColumnA>
<TestColumnB>01/01/2008 12:13:14</TestColumnB>
</TestDataTable>
<TestDataTable>
<TestColumnA>Is A > B?</TestColumnA>
<TestColumnB>02/02/2008 20:21:22</TestColumnB>
</TestDataTable>
</TestDataSet>
Note the use of ISO 8601 date format in ResultA but locale date format in
ResultB
Expected Results (From running the application on .NET):
Result A
<?xml version="1.0" standalone="yes"?>
<TestDataSet>
<TestDataTable>
<TestColumnA>Hello World!</TestColumnA>
<TestColumnB>2008-01-01T12:13:14+00:00</TestColumnB>
</TestDataTable>
<TestDataTable>
<TestColumnA>Is A > B?</TestColumnA>
<TestColumnB>2008-02-02T20:21:22+00:00</TestColumnB>
</TestDataTable>
</TestDataSet>
ResultB
<TestDataSet>
<TestDataTable>
<TestColumnA>Hello World!</TestColumnA>
<TestColumnB>2008-01-01T12:13:14+00:00</TestColumnB>
</TestDataTable>
<TestDataTable>
<TestColumnA>Is A > B?</TestColumnA>
<TestColumnB>2008-02-02T20:21:22+00:00</TestColumnB>
</TestDataTable>
</TestDataSet>
Note the use of ISO 8601 date format in both results
How often does this happen?
Always
Additional Information:
I found a similar bug report that was raised against the DataSet.WriteXml
method and was fixed.
https://bugzilla.novell.com/show_bug.cgi?id=MONO38661
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list