Method: REXML::Attribute#prefix

Defined in:
lib/extensions/rexml/rexml/attribute.rb,
lib/extensions/rhoxml/rexml/attribute.rb

#prefixObject

Returns the namespace of the attribute.

e = Element.new( "elns:myelement" )
e.add_attribute( "nsa:a", "aval" )
e.add_attribute( "b", "bval" )
e.attributes.get_attribute( "a" ).prefix   # -> "nsa"
e.attributes.get_attribute( "b" ).prefix   # -> "elns"
a = Attribute.new( "x", "y" )
a.prefix                                   # -> ""


72
73
74
75
76
77
78
# File 'lib/extensions/rexml/rexml/attribute.rb', line 72

def prefix
  pf = super
  if pf == ""
    pf = @element.prefix if @element
  end
  pf
end