void AddNamespace(string prefix, string ns, bool declared) {
int nsIndex = ++nsTop;
if ( nsIndex == nsStack.Length ) {
Namespace[] newStack = new Namespace[nsIndex * 2];
Array.Copy(nsStack, newStack, nsIndex);
nsStack = newStack;
}
nsStack[nsIndex].Set(prefix, ns, declared);
if (useNsHashtable) {
AddToNamespaceHashtable(nsIndex);
}
else if (nsIndex == MaxNamespacesWalkCount) {
// add all
nsHashtable = new Dictionary<string, int>(new SecureStringHasher());
for (int i = 0; i <= nsIndex; i++) {
AddToNamespaceHashtable(i);
}
useNsHashtable = true;
}
}