class REXML::Attributes
def get_attribute( name )
attrs.get_attribute('nosuch') # => nil
attrs.get_attribute('att') # => att='<'
attrs.get_attribute('bar:att') # => bar:att='2'
attrs.get_attribute('foo:att').class # => REXML::Attribute
attrs.get_attribute('foo:att') # => foo:att='1'
attrs = ele.attributes
ele = d.root.elements['//ele'] # =>
d = REXML::Document.new(xml_string)
EOT
xml_string = <<-EOT
Returns the \REXML::Attribute object for the given +name+:
get_attribute(name) -> attribute_object or nil
:call-seq:
def get_attribute( name ) attr = fetch( name, nil ) if attr.nil? return nil if name.nil? # Look for prefix name =~ Namespace::NAMESPLIT prefix, n = $1, $2 if prefix attr = fetch( n, nil ) # check prefix if attr == nil elsif attr.kind_of? Attribute return attr if prefix == attr.prefix else attr = attr[ prefix ] return attr end end element_document = @element.document if element_document and element_document.doctype expn = @element.expanded_name expn = element_document.doctype.name if expn.size == 0 attr_val = element_document.doctype.attribute_of(expn, name) return Attribute.new( name, attr_val ) if attr_val end return nil end if attr.kind_of? Hash attr = attr[ @element.prefix ] end return attr end