The get_attribute_ns
method retrieves a method by its namespace and name. Thus it is possible to
reliably identify an attribute even if an XML
processor has changed the prefix.
# File lib/rexml/element.rb, line 1253
def get_attribute_ns(namespace, name)
result = nil
each_attribute() { |attribute|
if name == attribute.name &&
namespace == attribute.namespace() &&
( !namespace.empty? || !attribute.fully_expanded_name.index(':') )
# foo will match xmlns:foo, but only if foo isn't also an attribute
result = attribute if !result or !namespace.empty? or
!attribute.fully_expanded_name.index(':')
end
}
result
end