static void AddUniqueAccessor(INameScope scope, Accessor accessor) {
     Accessor existing = (Accessor)scope[accessor.Name, accessor.Namespace];
     if (existing != null) {
         if (accessor is ElementAccessor) {
             throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateElementName, existing.Name, existing.Namespace));
         }
         else {
             #if DEBUG
             if (!(accessor is AttributeAccessor))
                 throw new InvalidOperationException(Res.GetString(Res.XmlInternalErrorDetails, "Bad accessor type " + accessor.GetType().FullName));
             #endif
             throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateAttributeName, existing.Name, existing.Namespace));
         }
     }
     else {
         scope[accessor.Name, accessor.Namespace] = accessor;
     }
 }