Jelajahi Sumber

* XmlSchemaExporter.cs: When checking if a map has been exported or not,
don't use type name for array types, since we can have different classes
that represent the same array type (for example StringCollection and
string[]).

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

Lluis Sanchez 22 tahun lalu
induk
melakukan
eb342fa1b2

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

@@ -1,3 +1,10 @@
+2004-04-15  Lluis Sanchez Gual <[email protected]>
+
+	* XmlSchemaExporter.cs: When checking if a map has been exported or not,
+	  don't use type name for array types, since we can have different classes 
+	  that represent the same array type (for example StringCollection and 
+	  string[]).
+
 2004-04-14  Lluis Sanchez Gual <[email protected]>
 
 	* TypeTranslator.cs, XmlCustomFormatter.cs: Removed map from Uri to anyUri,

+ 15 - 2
mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs

@@ -684,9 +684,22 @@ namespace System.Xml.Serialization {
 		
 		string GetMapKey (XmlTypeMapping map)
 		{
-			return map.TypeData.FullTypeName + " " + map.XmlType + " " + map.XmlTypeNamespace;
+			// Don't use type name for array types, since we can have different
+			// classes that represent the same array type (for example
+			// StringCollection and string[]).
+			
+			if (map.TypeData.IsListType)
+				return GetArrayKeyName (map.TypeData) + " " + map.XmlType + " " + map.XmlTypeNamespace;
+			else
+				return map.TypeData.FullTypeName + " " + map.XmlType + " " + map.XmlTypeNamespace;
 		}
-
+		
+		string GetArrayKeyName (TypeData td)
+		{
+			TypeData etd = td.ListItemTypeData;
+			return "*arrayof*" + (etd.IsListType ? GetArrayKeyName (etd) : etd.FullTypeName);
+		}
+		
 		void CompileSchemas ()
 		{
 //			foreach (XmlSchema sc in schemas)