From 0bb5cc28e41342bf0da538129577a11f88f9e834 Mon Sep 17 00:00:00 2001 From: ser Date: Fri, 2 Apr 2004 03:57:03 +0000 Subject: REXML changes * The main purpose for this change is to get a fix in for nasty bug in XPath. In the new code for the descendant-or-self axis, the document order code was calling the wrong method to do node comparisons, causing a terrible overhead that slowed the axis down to the point where it was unusable. This is a common axis, also known as '//', so this fix is critical. * Using Element#text= on a non-Text, non-String argument caused an error. this has been changed so that the behavior is like puts() -- to_s() is called on the object first. * refactored the pretty-printing code a little. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rexml/element.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/rexml/element.rb') diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index b61d811141..d616d0311f 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -455,7 +455,12 @@ module REXML # doc.root.text = 'Russell' #-> 'Russell' # doc.root.text = nil #-> '' def text=( text ) - text = Text.new( text, whitespace(), nil, raw() ) if text.kind_of? String + if text.kind_of? String + text = Text.new( text, whitespace(), nil, raw() ) + else + text = Text.new( text.to_s, whitespace(), nil, raw() ) unless text.kind_of? Text + end + old_text = get_text if text.nil? old_text.remove unless old_text.nil? -- cgit v1.2.3