Author: kostat
Date: 2007-09-25 10:31:17 -0400 (Tue, 25 Sep 2007)
New Revision: 86326
Modified:
trunk/mcs/class/System.Data/System.Data/ChangeLog
trunk/mcs/class/System.Data/System.Data/DataSet.cs
trunk/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
Log:
correct WriteAttributeString while writing xml with XmlWriteMode.WriteSchema
Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog 2007-09-25 14:30:57 UTC
(rev 86325)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog 2007-09-25 14:31:17 UTC
(rev 86326)
@@ -1,3 +1,8 @@
+2007-09-25 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * DataSet.cs: correct WriteAttributeString while writing xml with
+ XmlWriteMode.WriteSchema.
+
2007-09-25 Nagappan A <[EMAIL PROTECTED]>
* DataTable.cs: Code alignment.
Modified: trunk/mcs/class/System.Data/System.Data/DataSet.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataSet.cs 2007-09-25 14:30:57 UTC
(rev 86325)
+++ trunk/mcs/class/System.Data/System.Data/DataSet.cs 2007-09-25 14:31:17 UTC
(rev 86326)
@@ -1767,9 +1767,9 @@
internal static void WriteAttributeString (XmlWriter writer,
XmlWriteMode mode, string nspc, string prefix, string name, string stringValue)
{
switch ( mode) {
- case XmlWriteMode.WriteSchema:
- writer.WriteAttributeString (prefix,
name, nspc);
- break;
+ // case XmlWriteMode.WriteSchema:
+ // writer.WriteAttributeString (prefix,
name, nspc);
+ // break;
case XmlWriteMode.DiffGram:
writer.WriteAttributeString (prefix,
name, nspc,stringValue);
break;
Modified: trunk/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/DataSetTest.cs 2007-09-25
14:30:57 UTC (rev 86325)
+++ trunk/mcs/class/System.Data/Test/System.Data/DataSetTest.cs 2007-09-25
14:31:17 UTC (rev 86326)
@@ -2019,6 +2019,41 @@
}
[Test]
+ public void WriteXmlModeSchema1 () {
+ string SerializedDataTable =
+@"<rdData>
+ <MyDataTable CustomerID='VINET' CompanyName='Vins et alcools Chevalier'
ContactName='Paul Henriot' />
+</rdData>";
+ string expected =
+@"<rdData>
+ <xs:schema id=""rdData"" xmlns=""""
xmlns:xs=""http://www.w3.org/2001/XMLSchema""
xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
+ <xs:element name=""rdData"" msdata:IsDataSet=""true""
msdata:UseCurrentLocale=""true"">
+ <xs:complexType>
+ <xs:choice minOccurs=""0"" maxOccurs=""unbounded"">
+ <xs:element name=""MyDataTable"">
+ <xs:complexType>
+ <xs:attribute name=""CustomerID"" type=""xs:string"" />
+ <xs:attribute name=""CompanyName"" type=""xs:string"" />
+ <xs:attribute name=""ContactName"" type=""xs:string"" />
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ <MyDataTable CustomerID=""VINET"" CompanyName=""Vins et alcools Chevalier""
ContactName=""Paul Henriot"" />
+</rdData>";
+ DataSet set;
+ set = new DataSet ();
+ set.ReadXml (new StringReader (SerializedDataTable));
+
+ StringWriter w = new StringWriter ();
+ set.WriteXml (w, XmlWriteMode.WriteSchema);
+ string result = w.ToString ();
+ Assert.AreEqual (result.Replace ("\r", ""),
expected.Replace ("\r", ""));
+ }
+
+ [Test]
public void DeserializeModifiedDataSet ()
{
// Serialization begins
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches