Class: REXML::Element

Inherits:
Object show all
Defined in:
lib/voruby/adql/ext.rb

Instance Method Summary collapse

Instance Method Details

#find_attribute(attr_name, ns = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/voruby/adql/ext.rb', line 2

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