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;
}
}