svn path=/trunk/mcs/; revision=64926
authorLluis Sanchez <lluis@novell.com>
Tue, 5 Sep 2006 11:42:28 +0000 (11:42 -0000)
committerLluis Sanchez <lluis@novell.com>
Tue, 5 Sep 2006 11:42:28 +0000 (11:42 -0000)
mcs/class/System.XML/System.Xml.Serialization/ChangeLog
mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs

index 9e5a9a3bb653a1b4b31b23322f1d8ec9e402d044..b5c977479a9a5e5cd85980d72e3f119877e073f2 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-05  Lluis Sanchez Gual  <lluis@novell.com>
+
+       * XmlSchemaImporter.cs: Always import simple type unions
+         as string (like MS.NET does). Fixes bug #79234.
+
 2006-08-25  Kornél Pál  <kornelpal@gmail.com>
 
        * MapCodeGenerator.cs: Use assembly file version constants.
index 8e0df5b58a4d3b07b867f816c3656a6ecac9691c..a8d9240c829e910042ecaa820ed9be7defddbc8c 100644 (file)
@@ -1154,7 +1154,7 @@ namespace System.Xml.Serialization
 \r
                TypeData FindBuiltInType (XmlQualifiedName qname, XmlSchemaSimpleType st)\r
                {\r
-                       if (CanBeEnum (st))\r
+                       if (CanBeEnum (st) && qname != null)\r
                                return ImportType (qname, null, true).TypeData;\r
 \r
                        if (st.Content is XmlSchemaSimpleTypeRestriction) {\r
@@ -1168,23 +1168,9 @@ namespace System.Xml.Serialization
                        else if (st.Content is XmlSchemaSimpleTypeList) {\r
                                return FindBuiltInType (GetContentBaseType (st.Content)).ListTypeData;\r
                        }\r
-                       else if (st.Content is XmlSchemaSimpleTypeUnion)\r
-                       {\r
-                               // Check if all types of the union are equal. If not, then will use anyType.\r
-                               XmlSchemaSimpleTypeUnion uni = (XmlSchemaSimpleTypeUnion) st.Content;\r
-                               TypeData utype = null;\r
-\r
-                               // Anonymous types are unique\r
-                               if (uni.BaseTypes.Count != 0 && uni.MemberTypes.Length != 0)\r
-                                       return FindBuiltInType (anyType);\r
-\r
-                               foreach (XmlQualifiedName mt in uni.MemberTypes)\r
-                               {\r
-                                       TypeData qn = FindBuiltInType (mt);\r
-                                       if (utype != null && qn != utype) return FindBuiltInType (anyType);\r
-                                       else utype = qn;\r
-                               }\r
-                               return utype;\r
+                       else if (st.Content is XmlSchemaSimpleTypeUnion) {\r
+                               // MS.NET always import simple unions as string\r
+                               return FindBuiltInType (new XmlQualifiedName ("string", XmlSchema.Namespace));\r
                        }\r
                        else\r
                                return null;\r