Pārlūkot izejas kodu

* XmlSchemaImporter.cs: Redefinition of types are not supported. Added a check.

svn path=/trunk/mcs/; revision=22547
Lluis Sanchez 22 gadi atpakaļ
vecāks
revīzija
450b8bce04

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

@@ -1,3 +1,8 @@
+2004-01-27  Lluis Sanchez Gual  <[email protected]>
+
+	* XmlSchemaImporter.cs: Redefinition of types are not supported. Added a
+	  check.
+
 2004-01-27  Lluis Sanchez Gual  <[email protected]>
 
 	* MapCodeGenerator.cs: Added helper method for generating an attribute

+ 4 - 0
mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs

@@ -288,6 +288,10 @@ namespace System.Xml.Serialization {
 				if (type == null) throw new InvalidOperationException ("Schema type '" + elem.SchemaTypeName + "' not found");
 				stype = (XmlSchemaType) type;
 				qname = stype.QualifiedName;
+				
+				XmlSchemaType btype = stype.BaseSchemaType as XmlSchemaType;
+				if (btype != null && btype.QualifiedName == elem.SchemaTypeName)
+					throw new InvalidOperationException ("Cannot import schema for type '" + elem.SchemaTypeName.Name + "' from namespace '" + elem.SchemaTypeName.Namespace + "'. Redefine not supported");
 			}
 
 			if (stype is XmlSchemaSimpleType) return false;