private bool KeepXmlnsDeclarations(XmlSchemaType type, out string xmlnsMemberName)
{
xmlnsMemberName = null;
if (type.Annotation == null)
return false;
if (type.Annotation.Items == null || type.Annotation.Items.Count == 0)
return false;
foreach (XmlSchemaObject o in type.Annotation.Items)
{
if (o is XmlSchemaAppInfo)
{
XmlNode[] nodes = ((XmlSchemaAppInfo)o).Markup;
if (nodes != null && nodes.Length > 0)
{
foreach (XmlNode node in nodes)
{
if (node is XmlElement)
{
XmlElement e = (XmlElement)node;
if (e.Name == "keepNamespaceDeclarations")
{
if (e.LastNode is XmlText)
{
xmlnsMemberName = (((XmlText)e.LastNode).Value).Trim(null);
}
return true;
}
}
}
}
}
}
return false;
}