System.Xml.Schema.SchemaNamespaceManager.LookupPrefix C# (CSharp) Method

LookupPrefix() public method

public LookupPrefix ( string ns ) : string
ns string
return string
        public override string LookupPrefix(string ns) {
            if (ns == XmlReservedNs.NsXml) { //Special case for the XML namespace
                return "xml";
            }
            Hashtable namespaces;
            for (XmlSchemaObject current = node; current != null; current = current.Parent) {
                namespaces = current.Namespaces.Namespaces;
                if (namespaces != null && namespaces.Count > 0) {
                    foreach(DictionaryEntry entry in namespaces) {
                        if (entry.Value.Equals(ns)) {
                            return (string)entry.Key;
                        }
                    }
                }
            }
            return null;
        }