get_attribute( name ) public

Fetches an attribute

name

the name by which to search for the attribute. Can be a prefix:name namespace name.

Returns

The first matching attribute, or nil if there was none. This

value is an Attribute node, not the String value of the attribute.

doc = Document.new '<a x:foo="1" foo="2" bar="3"/>'
doc.root.attributes.get_attribute("foo").value    #-> "2"
doc.root.attributes.get_attribute("x:foo").value  #-> "1"
Show source
Register or log in to add new notes.