Beispiel #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);
        }