private int LookupNamespaceDecl( string prefix ) {
if ( useHashtable ) {
int declIndex;
if ( hashTable.TryGetValue( prefix, out declIndex ) ) {
while ( declIndex != -1 && nsdecls[declIndex].uri == null ) {
declIndex = nsdecls[declIndex].previousNsIndex;
}
return declIndex;
}
return -1;
}
else {
// First assume that prefix is atomized
for( int thisDecl = lastDecl; thisDecl >= 0; thisDecl -- ) {
if ( (object)nsdecls[thisDecl].prefix == (object)prefix && nsdecls[thisDecl].uri != null ) {
return thisDecl;
}
}
// Non-atomized lookup
for( int thisDecl = lastDecl; thisDecl >= 0; thisDecl -- ) {
if ( String.Equals( nsdecls[thisDecl].prefix, prefix ) && nsdecls[thisDecl].uri != null ) {
return thisDecl;
}
}
}
return -1;
}