2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaGroup.cs
index 617a3fa3be6e704ff38d36f38e9ad6c0aa32f27f..d308b3f8668b50f35bc85bd68177808d1ac2ff93 100755 (executable)
@@ -5,6 +5,27 @@
 //     Dwivedi, Ajay kumar  Adwiv@Yahoo.com\r
 //     Atsushi Enomoto  ginga@kit.hi-ho.ne.jp\r
 //\r
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
 using System;\r
 using System.Collections;\r
 using System.Xml.Serialization;\r
@@ -22,10 +43,11 @@ namespace System.Xml.Schema
                private XmlQualifiedName qualifiedName;\r
                private bool isCircularDefinition;\r
                \r
-               private static string xmlname = "group";\r
+               const string xmlname = "group";\r
 \r
                public XmlSchemaGroup()\r
                {\r
+                       qualifiedName = XmlQualifiedName.Empty;\r
                }\r
 \r
                [System.Xml.Serialization.XmlAttribute("name")]\r
@@ -45,7 +67,11 @@ namespace System.Xml.Schema
                }\r
 \r
                [XmlIgnore]\r
+#if NET_2_0\r
+               public XmlQualifiedName QualifiedName \r
+#else\r
                internal XmlQualifiedName QualifiedName \r
+#endif\r
                {\r
                        get{ return qualifiedName;}\r
                }\r
@@ -57,13 +83,17 @@ namespace System.Xml.Schema
 \r
                // 1. name must be present\r
                // 2. MinOccurs & MaxOccurs of the Particle must be absent\r
-               [MonoTODO]\r
                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
                                return 0;\r
 \r
+#if NET_2_0\r
+                       if (Particle != null)\r
+                               Particle.Parent = this;\r
+#endif\r
+\r
                        if(Name == null)\r
                                error(h,"Required attribute name must be present");\r
                        else if(!XmlSchemaUtil.CheckNCName(this.name)) \r
@@ -82,22 +112,7 @@ namespace System.Xml.Schema
                                if(Particle.MinOccursString != null)\r
                                        Particle.error(h,"MinOccurs must not be present when the Particle is a child of Group");\r
                        \r
-                               if(Particle is XmlSchemaChoice)\r
-                               {\r
-                                       errorCount += ((XmlSchemaChoice)Particle).Compile(h,schema);\r
-                               }\r
-                               else if(Particle is XmlSchemaSequence)\r
-                               {\r
-                                       errorCount += ((XmlSchemaSequence)Particle).Compile(h,schema);\r
-                               }\r
-                               else if(Particle is XmlSchemaAll)\r
-                               {\r
-                                       errorCount += ((XmlSchemaAll)Particle).Compile(h,schema);\r
-                               }\r
-                               else\r
-                               {\r
-                                       error(h,"only all,choice or sequence are allowed");\r
-                               }\r
+                               Particle.Compile (h, schema);\r
                        }\r
                        \r
                        XmlSchemaUtil.CompileID(Id,this,schema.IDCollection,h);\r
@@ -106,7 +121,6 @@ namespace System.Xml.Schema
                        return errorCount;\r
                }\r
                \r
-               [MonoTODO]\r
                internal override int Validate(ValidationEventHandler h, XmlSchema schema)\r
                {\r
                        if (this.IsValidated (schema.ValidationId))\r