private static Attribute FindAttribute (object[] attributes)
{
// if there exists more than one attribute of the given type, throw an exception
if (attributes.Length > 1) {
throw new AmbiguousMatchException (Locale.GetText (
"<element> has more than one attribute of type <attribute_type>"));
}
if (attributes.Length < 1)
return null;
// tested above for '> 1' and and '< 1', so only '== 1' is left,
// i.e. we found the attribute
return (Attribute) attributes[0];
}