2003-09-30 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaSimpleContent.cs
index 2c2fce3f93339136807ae3e7dc27997699603bcd..044c6f3e4d9923f8390299a682a416d7326066f1 100755 (executable)
@@ -1,5 +1,10 @@
-// Author: Dwivedi, Ajay kumar\r
-//            Adwiv@Yahoo.com\r
+//\r
+// System.Xml.Schema.XmlSchemaSimpleContent.cs\r
+//\r
+// Author:\r
+//     Dwivedi, Ajay kumar  Adwiv@Yahoo.com\r
+//     Atsushi Enomoto  ginga@kit.hi-ho.ne.jp\r
+//\r
 using System;\r
 using System.Xml.Serialization;\r
 using System.Xml;\r
@@ -13,12 +18,13 @@ namespace System.Xml.Schema
        {\r
                private XmlSchemaContent content;\r
                private static string xmlname = "simpleContent";\r
+               internal object actualBaseSchemaType;\r
                public XmlSchemaSimpleContent()\r
                {\r
                }\r
 \r
-               [XmlElement("restriction",typeof(XmlSchemaSimpleContentRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]\r
-               [XmlElement("extension",typeof(XmlSchemaSimpleContentExtension),Namespace="http://www.w3.org/2001/XMLSchema")]\r
+               [XmlElement("restriction",typeof(XmlSchemaSimpleContentRestriction),Namespace=XmlSchema.Namespace)]\r
+               [XmlElement("extension",typeof(XmlSchemaSimpleContentExtension),Namespace=XmlSchema.Namespace)]\r
                public override XmlSchemaContent Content \r
                {\r
                        get{ return  content; } \r
@@ -29,8 +35,12 @@ namespace System.Xml.Schema
                /// 1. Content must be present and one of restriction or extention\r
                ///</remarks>\r
                [MonoTODO]\r
-               internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\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(Content == null)\r
                        {\r
                                error(h, "Content must be present in a simpleContent");\r
@@ -40,24 +50,31 @@ namespace System.Xml.Schema
                                if(Content is XmlSchemaSimpleContentRestriction)\r
                                {\r
                                        XmlSchemaSimpleContentRestriction xscr = (XmlSchemaSimpleContentRestriction) Content;\r
-                                       errorCount += xscr.Compile(h,info);\r
+                                       errorCount += xscr.Compile(h, schema);\r
                                }\r
                                else if(Content is XmlSchemaSimpleContentExtension)\r
                                {\r
                                        XmlSchemaSimpleContentExtension xsce = (XmlSchemaSimpleContentExtension) Content;\r
-                                       errorCount += xsce.Compile(h,info);\r
+                                       errorCount += xsce.Compile(h, schema);\r
                                }\r
                                else\r
                                        error(h,"simpleContent can't have any value other than restriction or extention");\r
                        }\r
                        \r
-                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+                       XmlSchemaUtil.CompileID(Id,this, schema.IDCollection,h);\r
+                       this.CompilationId = schema.CompilationId;\r
                        return errorCount;\r
                }\r
                \r
                [MonoTODO]\r
-               internal int Validate(ValidationEventHandler h)\r
+               internal override int Validate(ValidationEventHandler h, XmlSchema schema)\r
                {\r
+                       if (IsValidated (schema.ValidationId))\r
+                               return errorCount;\r
+\r
+                       errorCount += this.Content.Validate (h, schema);\r
+\r
+                       ValidationId = schema.ValidationId;\r
                        return errorCount;\r
                }\r
                //<simpleContent \r