Author: atsushi
Date: 2006-11-22 09:17:49 -0500 (Wed, 22 Nov 2006)
New Revision: 68351
Modified:
trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
trunk/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
Log:
2006-11-22 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlCustomFormatter.cs : handle hexBinary type. Fixed bug #79989
and #79990.
* XmlSerializerTests.cs : added test for hexBinary.
Modified: trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
2006-11-22 14:14:39 UTC (rev 68350)
+++ trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
2006-11-22 14:17:49 UTC (rev 68351)
@@ -1,5 +1,10 @@
2006-11-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * XmlCustomFormatter.cs : handle hexBinary type. Fixed bug #79989
+ and #79990.
+
+2006-11-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+
Fixed bug #78611.
* TypeData.cs, TypeTranslator.cs: improved TypeData to actually store
"nullable" information. Introduced new primitiveNullableTypes pool
Modified:
trunk/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
2006-11-22 14:14:39 UTC (rev 68350)
+++ trunk/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
2006-11-22 14:17:49 UTC (rev 68351)
@@ -241,6 +241,7 @@
case "guid": return XmlConvert.ToString
((Guid)value);
case "base64":
case "base64Binary": return value == null ?
String.Empty : Convert.ToBase64String ((byte[])value);
+ case "hexBinary": return value == null ?
String.Empty : XmlConvert.ToBinHexString ((byte[]) value);
case "duration": return XmlConvert.ToString
((TimeSpan) value);
default: return value is IFormattable ? ((IFormattable)
value).ToString (null, CultureInfo.InvariantCulture) : value.ToString ();
}
@@ -271,6 +272,7 @@
case "guid": return XmlConvert.ToGuid (value);
case "base64":
case "base64Binary": return
Convert.FromBase64String (value);
+ case "hexBinary": return
XmlConvert.FromBinHexString (value);
case "duration": return XmlConvert.ToTimeSpan
(value);
default:
if (type.Type != null)
Modified: trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
2006-11-22 14:14:39 UTC (rev 68350)
+++ trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
2006-11-22 14:17:49 UTC (rev 68351)
@@ -1,5 +1,9 @@
2006-11-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * XmlSerializerTests.cs : added test for hexBinary.
+
+2006-11-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* XmlReflectionImporterTests.cs : added test for class that contains
nullable value type field whose XmlElementAttribute IsNullable.
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
===================================================================
---
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
2006-11-22 14:14:39 UTC (rev 68350)
+++
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
2006-11-22 14:17:49 UTC (rev 68351)
@@ -2149,6 +2149,27 @@
}
#endif
+ [Test] // bug #79989, #79990
+ public void SerializeHexBinary()
+ {
+ XmlSerializer ser = new XmlSerializer (typeof
(HexBinary));
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ ser.Serialize (xtw, new HexBinary ());
+ xtw.Close ();
+ string expected = @"<?xml version=""1.0""
encoding=""utf-16""?><HexBinary xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" Data=""010203"" />";
+ Assert.AreEqual (expected, sw.ToString ());
+ HexBinary h = (HexBinary) ser.Deserialize (new
StringReader (sw.ToString ()));
+ Assert.AreEqual (new byte [] {1, 2, 3}, h.Data);
+ }
+
+ [XmlRoot ("HexBinary")]
+ public class HexBinary
+ {
+ [XmlAttribute (DataType = "hexBinary")]
+ public byte [] Data = new byte [] {1, 2, 3};
+ }
+
public class CDataTextNodesType
{
public CDataTextNodesInternal foo;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches