[]

[](name)
Instance Public methods

Fetches an attribute value. If you want to get the Attribute itself, use #get_attribute()

name

an XPath attribute name. Namespaces are relevant here.

Returns

the String value of the matching attribute, or nil if no matching attribute was found. This is the unnormalized value (with entities expanded).

doc = Document.new "<a foo:att='1' bar:att='2' att='&lt;'/>"
doc.root.attributes['att']         #-> '<'
doc.root.attributes['bar:att']     #-> '2'
doc_ruby_on_rails
2015-05-06 01:13:01
Comments
Leave a Comment

Please login to continue.