internal string GetInstanceName(XmlSchemaAnnotated node)
{
string instanceName = null;
Debug.Assert((node is XmlSchemaElement) || (node is XmlSchemaAttribute), "GetInstanceName should only be called on attribute or elements");
if (node is XmlSchemaElement)
{
XmlSchemaElement el = (XmlSchemaElement)node;
instanceName = el.Name != null ? el.Name : el.RefName.Name;
}
else if (node is XmlSchemaAttribute)
{
XmlSchemaAttribute el = (XmlSchemaAttribute)node;
instanceName = el.Name != null ? el.Name : el.RefName.Name;
}
Debug.Assert((instanceName != null) && (instanceName.Length != 0), "instanceName cannot be null or empty. There's an error in the XSD compiler");
return instanceName;
}