System.Xml.Schema.XsdValidator.ThoroughGetElementDecl C# (CSharp) Méthode

ThoroughGetElementDecl() private méthode

private ThoroughGetElementDecl ( SchemaElementDecl elementDecl, XmlQualifiedName xsiType, string xsiNil ) : SchemaElementDecl
elementDecl SchemaElementDecl
xsiType System.Xml.XmlQualifiedName
xsiNil string
Résultat SchemaElementDecl
        private SchemaElementDecl ThoroughGetElementDecl(SchemaElementDecl elementDecl, XmlQualifiedName xsiType, string xsiNil) {
            if (elementDecl == null) {
                elementDecl = schemaInfo.GetElementDecl(elementName);
            }
            if (elementDecl != null) {
                if (xsiType.IsEmpty) {
                    if (elementDecl.IsAbstract) {
                        SendValidationEvent(Res.Sch_AbstractElement, XmlSchemaValidator.QNameString(context.LocalName, context.Namespace));
                        elementDecl = null;
                    }
                }
                else if(xsiNil != null && xsiNil.Equals("true")) {
                    SendValidationEvent(Res.Sch_XsiNilAndType);
                }
                else {
                    SchemaElementDecl elementDeclXsi = (SchemaElementDecl)schemaInfo.ElementDeclsByType[xsiType];
                    if (elementDeclXsi == null && xsiType.Namespace == NsXs) {
                        XmlSchemaSimpleType simpleType = DatatypeImplementation.GetSimpleTypeFromXsdType(new XmlQualifiedName(xsiType.Name,NsXs));
                        if (simpleType != null) {
                            elementDeclXsi = simpleType.ElementDecl;
                        }
                    }
                    if (elementDeclXsi == null) {
                        SendValidationEvent(Res.Sch_XsiTypeNotFound, xsiType.ToString());
                        elementDecl = null;
                    }
                    else if (!XmlSchemaType.IsDerivedFrom(elementDeclXsi.SchemaType,elementDecl.SchemaType,elementDecl.Block)) {
                        SendValidationEvent(Res.Sch_XsiTypeBlockedEx, new string[] { xsiType.ToString(), XmlSchemaValidator.QNameString(context.LocalName, context.Namespace) });
                        elementDecl = null;
                    }
                    else {
                        elementDecl = elementDeclXsi;
                    }
                }
                if (elementDecl != null && elementDecl.IsNillable) {
                    if (xsiNil != null) {
                        context.IsNill = XmlConvert.ToBoolean(xsiNil);
                        if (context.IsNill && elementDecl.DefaultValueTyped != null) {
                            SendValidationEvent(Res.Sch_XsiNilAndFixed);
                        }
                    }
                }
                else if (xsiNil != null) {
                    SendValidationEvent(Res.Sch_InvalidXsiNill);
                }
            }
            return elementDecl;
        }