Method: REXML::Attribute#to_string

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

#to_stringObject

Returns this attribute out as XML source, expanding the name

a = Attribute.new( "x", "y" )
a.to_string     # -> "x='y'"
b = Attribute.new( "ns:x", "y" )
b.to_string     # -> "ns:x='y'"


107
108
109
110
111
112
113
# File 'lib/extensions/rexml/rexml/attribute.rb', line 107

def to_string
  if @element and @element.context and @element.context[:attribute_quote] == :quote
    %Q^#@expanded_name="#{to_s().gsub(/"/, '&quote;')}"^
  else
    "#@expanded_name='#{to_s().gsub(/'/, ''')}'"
  end
end