System.Xml.Schema.SchemaCollectionCompiler.CompileComplexContentRestriction C# (CSharp) Method

CompileComplexContentRestriction() private method

private CompileComplexContentRestriction ( XmlSchemaComplexType complexType, XmlSchemaComplexContent complexContent, XmlSchemaComplexContentRestriction complexRestriction ) : void
complexType XmlSchemaComplexType
complexContent XmlSchemaComplexContent
complexRestriction XmlSchemaComplexContentRestriction
return void
        private void CompileComplexContentRestriction(XmlSchemaComplexType complexType, XmlSchemaComplexContent complexContent, XmlSchemaComplexContentRestriction complexRestriction) {
            XmlSchemaComplexType baseType = null;
            if (complexType.Redefined != null && complexRestriction.BaseTypeName == complexType.Redefined.QualifiedName) {
                baseType = (XmlSchemaComplexType)complexType.Redefined;
                CompileComplexType(baseType);
            }
            else {
                baseType = GetComplexType(complexRestriction.BaseTypeName);
                if (baseType == null) {
                    SendValidationEvent(Res.Sch_UndefBaseRestriction, complexRestriction.BaseTypeName.ToString(), complexRestriction);   
                    return;
                }
            } 
            if (baseType != null && baseType.ElementDecl != null) {
                if (baseType.ContentType == XmlSchemaContentType.TextOnly) {
                    SendValidationEvent(Res.Sch_NotComplexContent, complexType);
                    return;
                }
            }
            complexType.SetBaseSchemaType(baseType);
            if ((baseType.FinalResolved & XmlSchemaDerivationMethod.Restriction) != 0) {
                SendValidationEvent(Res.Sch_BaseFinalRestriction, complexType);
            }
            CompileLocalAttributes(baseType, complexType, complexRestriction.Attributes, complexRestriction.AnyAttribute, XmlSchemaDerivationMethod.Restriction);
            
            complexType.SetContentTypeParticle(CompileContentTypeParticle(complexRestriction.Particle, true));
            complexType.SetContentType(GetSchemaContentType(complexType, complexContent, complexType.ContentTypeParticle));
            if (complexType.ContentType == XmlSchemaContentType.Empty) {
                if (baseType.ElementDecl != null) {
                    Debug.Assert(baseType.ElementDecl.ContentValidator != null);
                }
                if (baseType.ElementDecl != null && !baseType.ElementDecl.ContentValidator.IsEmptiable) {
                    SendValidationEvent(Res.Sch_InvalidContentRestriction, complexType);
                }
            }
            complexType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
        }