class XML::XXPath::Accessors::Attribute

attribute node, more or less call-compatible with REXML's Element. REXML's Attribute class doesn't provide this…

The all/first calls return instances of this class if they matched an attribute node.

Attributes

name[RW]
parent[R]

Public Class Methods

new(parent,name) click to toggle source
# File lib/xml/rexml_ext.rb, line 74
def initialize(parent,name)
  @parent,@name = parent,name
end
new(parent,name,create) click to toggle source
Calls superclass method
# File lib/xml/rexml_ext.rb, line 78
def self.new(parent,name,create)
  if parent.attributes[name]
    super(parent,name)
  else
    if create
      parent.attributes[name] = "[unset]"
      super(parent,name)
    else
      nil
    end
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/xml/rexml_ext.rb, line 100
def ==(other)
  other.kind_of?(Attribute) and other.parent==parent and other.name==name
end
text() click to toggle source

the value of the attribute.

# File lib/xml/rexml_ext.rb, line 92
def text
  parent.attributes[@name]
end
text=(x) click to toggle source
# File lib/xml/rexml_ext.rb, line 96
def text=(x)
  parent.attributes[@name] = x
end