Ejemplo n.º 1
0
        /// <remarks>
        /// 1. One of itemType or a <simpleType> must be present, but not both.
        /// 2. id must be of type ID
        /// </remarks>
        internal override int Compile(ValidationEventHandler h, XmlSchema schema)
        {
            // If this is already compiled this time, simply skip.
            if (CompilationId == schema.CompilationId)
            {
                return(0);
            }

            errorCount = 0;

            if (ItemType != null && !ItemTypeName.IsEmpty)
            {
                error(h, "both itemType and simpletype can't be present");
            }
            if (ItemType == null && ItemTypeName.IsEmpty)
            {
                error(h, "one of itemType or simpletype must be present");
            }
            if (ItemType != null)
            {
                errorCount += ItemType.Compile(h, schema);
            }
            if (!XmlSchemaUtil.CheckQName(ItemTypeName))
            {
                error(h, "BaseTypeName must be a XmlQualifiedName");
            }

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

            this.CompilationId = schema.CompilationId;
            return(errorCount);
        }