Method: REXML::Text#to_s

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

#to_sObject

Returns the string value of this text node. This string is always escaped, meaning that it is a valid XML text node string, and all entities that can be escaped, have been inserted. This method respects the entity filter set in the constructor.

# Assume that the entity "s" is defined to be "sean", and that the 
# entity "r" is defined to be "russell"
t = Text.new( "< & sean russell", false, nil, false, ['s'] ) 
t.to_s   #-> "&lt; &amp; &s; russell"
t = Text.new( "< & &s; russell", false, nil, false ) 
t.to_s   #-> "&lt; &amp; &s; russell"
u = Text.new( "sean russell", false, nil, true )
u.to_s   #-> "sean russell"


221
222
223
224
225
226
# File 'lib/extensions/rexml/rexml/text.rb', line 221

def to_s
  return @string if @raw
  return @normalized if @normalized

  @normalized = Text::normalize( @string, doctype, @entity_filter )
end