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;
}