Class: REXML::Attributes

Class REXML::Attributes |
In: | /home/ser/Work/rexml/rexml/element.rb
Parent: | Hash

A class that holds the Attributes of an Element.

Methods

[] []= add delete delete_all each_attribute get_attribute new prefixes

Public Class methods

new(element)

Constructor @param element the Element of which this is an Attribute

Public Instance methods

[](name)

Fetches an attribute value. If you want to get the Attribute itself, use get_attribute() @param name an XPath attribute name @return A String, which is the value of the first matching attribute, or nil if there was none

each_attribute() {|val| ...}

get_attribute( name )

Fetches an attribute @param name the XPath by which to search for the attribute @return The first matching Attribute, or nil if there was none

[]=( name, value = nil )

Sets an attribute, overwriting any existing attribute value by the same name @param name the name of the attribute @param value (optional) If supplied, the value of the attribute. If nil, any existing matching attribute is deleted. @return self NOTE that unlike most REXML methods, this does not return the set Attribute.

prefixes()

delete( attribute )

Removes an attribute @return the removed attribute

add( attribute )

Adds an attribute, overriding any existing attribute by the same name. @param attribute must be an Attribute

delete_all( xpath )

DO NOT USE THIS METHOD! It WILL fail, and may be removed. If you absolutely need this method, write the author. Deletes all attributes matching an xpath @param xpath A String; all attributes that match this path will be removed @return an Array of the Attributes that were removed