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

LookupNamespace() public method

public LookupNamespace ( string prefix ) : string
prefix string
return string
        public override string LookupNamespace(string prefix) {
            if (prefix == "xml") { //Special case for the XML namespace
                return XmlReservedNs.NsXml;
            }
            Hashtable namespaces;
            for (XmlSchemaObject current = node; current != null; current = current.Parent) {
                namespaces = current.Namespaces.Namespaces;
                if (namespaces != null && namespaces.Count > 0) {
                    object uri = namespaces[prefix];
                    if (uri != null)
                        return (string)uri;
                }
            }
            return prefix.Length == 0 ? string.Empty : null;
        }