2006-07-27 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaElement.cs
index 90c698b8be8394a6ecf7e81695bd0391743d05e7..944a2709d1452f007b757db72e3919b0bd45a7f8 100644 (file)
@@ -350,7 +350,7 @@ namespace System.Xml.Schema
                internal override int Compile(ValidationEventHandler h, XmlSchema schema)\r
                {\r
                        // If this is already compiled this time, simply skip.\r
-                       if (this.IsComplied (schema.CompilationId))\r
+                       if (CompilationId == schema.CompilationId)\r
                                return 0;\r
                        InitPostCompileInformations ();\r
                        this.schema = schema;\r
@@ -653,7 +653,7 @@ namespace System.Xml.Schema
                        if (schemaType != null)\r
                                elementType = schemaType;\r
                        else if (SchemaTypeName != XmlQualifiedName.Empty) {\r
-                               XmlSchemaType type = schema.SchemaTypes [SchemaTypeName] as XmlSchemaType;\r
+                               XmlSchemaType type = schema.FindSchemaType (SchemaTypeName);\r
                                if (type != null) {\r
                                        type.Validate (h, schema);\r
                                        elementType = type;\r
@@ -743,9 +743,13 @@ namespace System.Xml.Schema
                                ident.Validate (h, schema);\r
 \r
 #if NET_2_0\r
-                       elementSchemaType = elementType as XmlSchemaType;\r
-                       if (elementSchemaType == null && elementType != null)\r
-                               elementSchemaType = XmlSchemaType.GetBuiltInType (((XmlSchemaDatatype) elementType).TypeCode);\r
+                       if (elementType != null) {\r
+                               elementSchemaType = elementType as XmlSchemaType;\r
+                               if (elementType == XmlSchemaSimpleType.AnySimpleType)\r
+                                       elementSchemaType = XmlSchemaSimpleType.XsAnySimpleType;\r
+                               if (elementSchemaType == null)\r
+                                       elementSchemaType = XmlSchemaType.GetBuiltInSimpleType (SchemaTypeName);\r
+                       }\r
 #endif\r
 \r
                        ValidationId = schema.ValidationId;\r
@@ -918,8 +922,7 @@ namespace System.Xml.Schema
                                                        break;\r
                                                }\r
                                        } else {\r
-                                               if (any.TargetNamespace.Length == 0 ||\r
-                                                       any.TargetNamespace != this.QualifiedName.Namespace)\r
+                                               if (any.TargetNamespace != this.QualifiedName.Namespace)\r
                                                        error (h, "Ambiguous element label which is contained by -any- particle with ##other value was detected: " + this.QualifiedName);\r
                                        }\r
                                }\r