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

GetGlobalElementDeclaration() static private method

static private GetGlobalElementDeclaration ( XmlSchemaSet schemas, XmlQualifiedName typeQName, bool &isNullable ) : XmlQualifiedName
schemas System.Xml.Schema.XmlSchemaSet
typeQName System.Xml.XmlQualifiedName
isNullable bool
return System.Xml.XmlQualifiedName
        internal static XmlQualifiedName GetGlobalElementDeclaration(XmlSchemaSet schemas, XmlQualifiedName typeQName, out bool isNullable)
        {
            ICollection currentSchemas = schemas.Schemas();
            string ns = typeQName.Namespace;
            if (ns == null)
                ns = string.Empty;
            isNullable = false;
            foreach (XmlSchema schema in currentSchemas)
            {
                foreach (XmlSchemaObject schemaObject in schema.Items)
                {
                    XmlSchemaElement schemaElement = schemaObject as XmlSchemaElement;
                    if (schemaElement == null)
                        continue;

                    if (schemaElement.SchemaTypeName.Equals(typeQName))
                    {
                        isNullable = schemaElement.IsNillable;
                        return new XmlQualifiedName(schemaElement.Name, schema.TargetNamespace);
                    }
                }
            }
            return null;
        }