示例#1
0
        /// <remarks>
        /// 1. Content must be present
        /// </remarks>
        internal override int Compile(ValidationEventHandler h, XmlSchema schema)
        {
            // If this is already compiled this time, simply skip.
            if (CompilationId == schema.CompilationId)
            {
                return(0);
            }

            if (isRedefinedComponent)
            {
                if (Annotation != null)
                {
                    Annotation.isRedefinedComponent = true;
                }
                if (Content != null)
                {
                    Content.isRedefinedComponent = true;
                }
            }

            if (Content == null)
            {
                error(h, "Content must be present in a complexContent");
            }
            else
            {
                if (Content is XmlSchemaComplexContentRestriction)
                {
                    XmlSchemaComplexContentRestriction xscr = (XmlSchemaComplexContentRestriction)Content;
                    errorCount += xscr.Compile(h, schema);
                }
                else if (Content is XmlSchemaComplexContentExtension)
                {
                    XmlSchemaComplexContentExtension xsce = (XmlSchemaComplexContentExtension)Content;
                    errorCount += xsce.Compile(h, schema);
                }
                else
                {
                    error(h, "complexContent can't have any value other than restriction or extention");
                }
            }

            XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h);

            this.CompilationId = schema.CompilationId;
            return(errorCount);
        }
 internal override int Compile(ValidationEventHandler h, XmlSchema schema)
 {
     if (this.CompilationId == schema.CompilationId)
     {
         return(0);
     }
     if (this.isRedefinedComponent)
     {
         if (base.Annotation != null)
         {
             base.Annotation.isRedefinedComponent = true;
         }
         if (this.Content != null)
         {
             this.Content.isRedefinedComponent = true;
         }
     }
     if (this.Content == null)
     {
         base.error(h, "Content must be present in a complexContent");
     }
     else if (this.Content is XmlSchemaComplexContentRestriction)
     {
         XmlSchemaComplexContentRestriction xmlSchemaComplexContentRestriction = (XmlSchemaComplexContentRestriction)this.Content;
         this.errorCount += xmlSchemaComplexContentRestriction.Compile(h, schema);
     }
     else if (this.Content is XmlSchemaComplexContentExtension)
     {
         XmlSchemaComplexContentExtension xmlSchemaComplexContentExtension = (XmlSchemaComplexContentExtension)this.Content;
         this.errorCount += xmlSchemaComplexContentExtension.Compile(h, schema);
     }
     else
     {
         base.error(h, "complexContent can't have any value other than restriction or extention");
     }
     XmlSchemaUtil.CompileID(base.Id, this, schema.IDCollection, h);
     this.CompilationId = schema.CompilationId;
     return(this.errorCount);
 }