System.Runtime.Serialization.SchemaHelper.GetSchemaWithGlobalElementDeclaration C# (CSharp) Method

GetSchemaWithGlobalElementDeclaration() static private method

static private GetSchemaWithGlobalElementDeclaration ( XmlSchemaElement element, XmlSchemaSet schemas ) : XmlSchema
element System.Xml.Schema.XmlSchemaElement
schemas System.Xml.Schema.XmlSchemaSet
return System.Xml.Schema.XmlSchema
        internal static XmlSchema GetSchemaWithGlobalElementDeclaration(XmlSchemaElement element, XmlSchemaSet schemas)
        {
            ICollection currentSchemas = schemas.Schemas();
            foreach (XmlSchema schema in currentSchemas)
            {
                foreach (XmlSchemaObject schemaObject in schema.Items)
                {
                    XmlSchemaElement schemaElement = schemaObject as XmlSchemaElement;
                    if (schemaElement == null)
                        continue;

                    if (schemaElement == element)
                    {
                        return schema;
                    }
                }
            }
            return null;
        }