System.Xml.XmlWellFormedWriter.LookupPrefix C# (CSharp) Méthode

LookupPrefix() public méthode

public LookupPrefix ( string ns ) : string
ns string
Résultat string
        public override string LookupPrefix(string ns)
        {
            try
            {
                if (ns == null)
                {
                    throw new ArgumentNullException(nameof(ns));
                }
                for (int i = _nsTop; i >= 0; i--)
                {
                    if (_nsStack[i].namespaceUri == ns)
                    {
                        string prefix = _nsStack[i].prefix;
                        for (i++; i <= _nsTop; i++)
                        {
                            if (_nsStack[i].prefix == prefix)
                            {
                                return null;
                            }
                        }
                        return prefix;
                    }
                }
                return (_predefinedNamespaces != null) ? _predefinedNamespaces.LookupPrefix(ns) : null;
            }
            catch
            {
                _currentState = State.Error;
                throw;
            }
        }

Usage Example

Exemple #1
0
 string IXmlNamespaceResolver.LookupPrefix(string namespaceName)
 {
     return(_wfWriter.LookupPrefix(namespaceName));
 }