class REXML::Element def find_attribute(attr_name, ns=nil) if !ns return self.attributes[attr_name] else ns_index = self.namespaces.index(ns) if ns_index ns_prefix = self.prefixes[ns_index] return self.attributes["#{ns_prefix}:#{attr_name}"] else return nil end end end end