2005-01-13 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaComplexType.cs
index 871093c01caea9e58641185a10cf8492e341fb90..9baea7d906ccbd4e9cc8a79aa2df911a1b7be268 100755 (executable)
@@ -179,6 +179,27 @@ namespace System.Xml.Schema
                {\r
                        get{ return attributeWildcard; }\r
                }\r
+\r
+#if NET_2_0\r
+               [XmlIgnore]\r
+               // LAMESPEC: This property is based on the premise that\r
+               // every particle has a unique name, but actually particles\r
+               // can be like:\r
+               // <sequence>\r
+               //  <element name='foo'/>\r
+               //  <element name='foo'>\r
+               //    <annotation>\r
+               //      <documentation>blah</documentation>\r
+               //    </annotation>\r
+               //  </element>\r
+               // </sequence>\r
+               //\r
+               // So with this signature this property can never be correct.\r
+               public XmlSchemaObjectTable LocalElements {\r
+                       get { throw new NotImplementedException (); }\r
+               }\r
+#endif\r
+\r
                #endregion\r
 \r
                internal XmlSchemaParticle ValidatableParticle \r
@@ -206,6 +227,17 @@ namespace System.Xml.Schema
                        if (this.IsComplied (schema.CompilationId))\r
                                return errorCount;\r
 \r
+#if NET_2_0\r
+                       if (ContentModel != null)\r
+                               ContentModel.Parent = this;\r
+                       if (Particle != null)\r
+                               Particle.Parent = this;\r
+                       if (AnyAttribute != null)\r
+                               AnyAttribute.Parent = this;\r
+                       foreach (XmlSchemaObject obj in Attributes)\r
+                               obj.Parent = this;\r
+#endif\r
+\r
                        ValidatedIsAbstract = isAbstract;\r
 \r
                        if (isRedefinedComponent) {\r
@@ -302,17 +334,13 @@ namespace System.Xml.Schema
                                        error(h,"attributes, particles or anyattribute is not allowed if ContentModel is present");\r
                                errorCount += contentModel.Compile (h, schema);\r
 \r
-                               XmlQualifiedName baseTypeName = null;\r
                                XmlSchemaSimpleContent smodel = ContentModel as XmlSchemaSimpleContent;\r
                                if(smodel != null)\r
                                {\r
                                        XmlSchemaSimpleContentExtension sscx = smodel.Content as XmlSchemaSimpleContentExtension;\r
-                                       if (sscx != null)\r
-                                               baseTypeName = sscx.BaseTypeName;\r
-                                       else {\r
+                                       if (sscx == null) {\r
                                                XmlSchemaSimpleContentRestriction sscr = smodel.Content as XmlSchemaSimpleContentRestriction;\r
                                                if (sscr != null) {\r
-                                                       baseTypeName = sscr.BaseTypeName;\r
                                                        if (sscr.BaseType != null) {\r
                                                                sscr.BaseType.Compile (h, schema);\r
                                                                BaseXmlSchemaTypeInternal = sscr.BaseType;\r
@@ -320,43 +348,11 @@ namespace System.Xml.Schema
                                                }\r
                                        }\r
                                }\r
-                               else\r
-                               {\r
-                                       XmlSchemaComplexContent cmodel = (XmlSchemaComplexContent) ContentModel;\r
-                                       XmlSchemaComplexContentExtension sccx = cmodel.Content as XmlSchemaComplexContentExtension;\r
-                                       if (sccx != null) {\r
-                                               baseTypeName = sccx.BaseTypeName;\r
-                                       }\r
-                                       else {\r
-                                               XmlSchemaComplexContentRestriction sccr = (XmlSchemaComplexContentRestriction) cmodel.Content;\r
-                                               if (sccr != null) {\r
-                                                       baseTypeName = sccr.BaseTypeName;\r
-                                               }\r
-                                       }\r
-                               }\r
                        }\r
                        else\r
                        {\r
-                               if(Particle is XmlSchemaGroupRef)\r
-                               {\r
-                                       XmlSchemaGroupRef xsgr = (XmlSchemaGroupRef)Particle;\r
-                                       errorCount += xsgr.Compile(h,schema);\r
-                               }\r
-                               else if(Particle is XmlSchemaAll)\r
-                               {\r
-                                       XmlSchemaAll xsa = (XmlSchemaAll)Particle;\r
-                                       errorCount += xsa.Compile(h,schema);\r
-                               }\r
-                               else if(Particle is XmlSchemaChoice)\r
-                               {\r
-                                       XmlSchemaChoice xsc = (XmlSchemaChoice)Particle;\r
-                                       errorCount += xsc.Compile(h,schema);\r
-                               }\r
-                               else if(Particle is XmlSchemaSequence)\r
-                               {\r
-                                       XmlSchemaSequence xss = (XmlSchemaSequence)Particle;\r
-                                       errorCount += xss.Compile(h,schema);\r
-                               }\r
+                               if (Particle != null)\r
+                                       errorCount += Particle.Compile (h, schema);\r
 \r
                                if(this.anyAttribute != null)\r
                                {\r
@@ -739,7 +735,7 @@ namespace System.Xml.Schema
                                        // do nothing for particle.\r
                                }\r
                                // otherwise, it might be missing sub components.\r
-                               else if (baseType == null && !schema.IsNamespaceAbsent (BaseSchemaTypeName.Namespace))// && schema.Schemas [baseTypeName.Namespace] != null)\r
+                               else if (baseType == null && !schema.IsNamespaceAbsent (BaseSchemaTypeName.Namespace))\r
                                        error (h, "Referenced base schema type " + BaseSchemaTypeName + " was not found in the corresponding schema.");\r
 \r
                                // 3.4.3 Complex Type Definition Representation OK :: 2.\r