فهرست منبع

* XmlSerializationWriter.cs: Implemented some missing methods.
In .NET 1.0, encoded null elements use the attribute null="1", while in
1.1 the attribute is nil="true".
* XmlTypeMapping.cs: Little fix for nested classes.

svn path=/trunk/mcs/; revision=27279

Lluis Sanchez 21 سال پیش
والد
کامیت
30314b972c

+ 7 - 0
mcs/class/System.XML/System.Xml.Serialization/ChangeLog

@@ -1,3 +1,10 @@
+2004-05-07  Lluis Sanchez Gual <[email protected]>
+
+	* XmlSerializationWriter.cs: Implemented some missing methods.
+	  In .NET 1.0, encoded null elements use the attribute null="1", while in
+	  1.1 the attribute is nil="true".
+	* XmlTypeMapping.cs: Little fix for nested classes.
+
 2004-05-07  Lluis Sanchez Gual <[email protected]>
 
 	* XmlReflectionImporter.cs: Don't reset the internal tables at every

+ 25 - 12
mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs

@@ -378,8 +378,9 @@ namespace System.Xml.Serialization {
 
 		protected void WriteElementStringRaw (string localName, string ns, byte[] value, XmlQualifiedName xsiType)
 		{
-                        if (value == null)
-			  return ;
+			if (value == null)
+				return;
+
 			WriteStartElement (localName, ns);
 
 			if (xsiType != null)
@@ -468,16 +469,20 @@ namespace System.Xml.Serialization {
 				WriteNullTagEncoded (name, ns);
 		}
 
-		[MonoTODO ("Implement")]
 		protected void WriteNullableStringEncodedRaw (string name, string ns, byte[] value, XmlQualifiedName xsiType)
 		{
-			throw new NotImplementedException ();
+			if (value == null)
+				WriteNullTagEncoded (name, ns);
+			else
+				WriteElementStringRaw (name, ns, value, xsiType);
 		}
 
-		[MonoTODO ("Implement")]
 		protected void WriteNullableStringEncodedRaw (string name, string ns, string value, XmlQualifiedName xsiType)
 		{
-			throw new NotImplementedException ();
+			if (value == null)
+				WriteNullTagEncoded (name, ns);
+			else
+				WriteElementStringRaw (name, ns, value, xsiType);
 		}
 
 		protected void WriteNullableStringLiteral (string name, string ns, string value)
@@ -488,16 +493,20 @@ namespace System.Xml.Serialization {
 				WriteNullTagLiteral (name, ns);
 		}
 
-		[MonoTODO ("Implement")]
 		protected void WriteNullableStringLiteralRaw (string name, string ns, byte[] value)
 		{
-			throw new NotImplementedException ();
+			if (value == null)
+				WriteNullTagLiteral (name, ns);
+			else
+				WriteElementStringRaw (name, ns, value);
 		}
 
-		[MonoTODO ("Implement")]
 		protected void WriteNullableStringLiteralRaw (string name, string ns, string value)
 		{
-			throw new NotImplementedException ();
+			if (value == null)
+				WriteNullTagLiteral (name, ns);
+			else
+				WriteElementStringRaw (name, ns, value);
 		}
 
 		protected void WriteNullTagEncoded (string name)
@@ -508,7 +517,11 @@ namespace System.Xml.Serialization {
 		protected void WriteNullTagEncoded (string name, string ns)
 		{
 			Writer.WriteStartElement (name, ns);
+#if NET_1_1
+			Writer.WriteAttributeString ("nil", XmlSchema.InstanceNamespace, "true");
+#else
 			Writer.WriteAttributeString ("null", XmlSchema.InstanceNamespace, "1");
+#endif
 			Writer.WriteEndElement ();
 		}
 
@@ -519,9 +532,9 @@ namespace System.Xml.Serialization {
 
 		protected void WriteNullTagLiteral (string name, string ns)
 		{
-			Writer.WriteStartElement (name, ns);
+			WriteStartElement (name, ns);
 			Writer.WriteAttributeString ("nil", XmlSchema.InstanceNamespace, "true");
-			Writer.WriteEndElement ();
+			WriteEndElement ();
 		}
 
 		protected void WritePotentiallyReferencingElement (string n, string ns, object o)

+ 1 - 0
mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs

@@ -113,6 +113,7 @@ namespace System.Xml.Serialization
 		{
 			// Returns the map for a subtype of this map's type
 
+			objectFullTypeName = objectFullTypeName.Replace ('+','.');
 			if (TypeFullName == objectFullTypeName) return this;
 			for (int n=0; n<_derivedTypes.Count; n++) {
 				XmlTypeMapping map = (XmlTypeMapping) _derivedTypes[n];