summaryrefslogtreecommitdiff
path: root/lib/rexml/text.rb
diff options
context:
space:
mode:
authorser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-23 15:44:30 +0000
committerser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-23 15:44:30 +0000
commitd15f41b0eb0f284cb15ee814c691e556ae20d8b1 (patch)
treeb2ee8d4e0c6f78c96cfa26c1d2a754e12fc82151 /lib/rexml/text.rb
parent7792d9026a592ffc9714bec34d9b911b226036e7 (diff)
* Non-String attributes are now converted to Strings; this means code such as
elem.attributes["a"] = 1 will not cause an error when dumping the XML. It also means that: elem.attributes["a"] # => "1", not 1 * Transitive indenting has been cleaned up. * Fixed a potential bug in parsing non-ASCII encoded streams * Fixed a bug where trying to fill in ParseException data was causing an IO error (stream closed) * Changes to Text mean that Element (and Text) can be used outside of a Document context. * In some rare cases, the base parser wasn't reading enough bytes from the stream for the parsing algorithm to work properly. This has been fixed (this was Ruby bug #48426) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/text.rb')
-rw-r--r--lib/rexml/text.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb
index 2e54f9fa11..1d2d2dd711 100644
--- a/lib/rexml/text.rb
+++ b/lib/rexml/text.rb
@@ -1,4 +1,8 @@
require 'rexml/entity'
+require 'rexml/doctype'
+require 'rexml/child'
+require 'rexml/doctype'
+require 'rexml/parseexception'
module REXML
# Represents text nodes in an XML document
@@ -271,16 +275,16 @@ module REXML
copy = input.clone
# Doing it like this rather than in a loop improves the speed
if doctype
- copy.gsub!( EREFERENCE, '&amp;' )
+ copy = copy.gsub( EREFERENCE, '&amp;' )
doctype.entities.each_value do |entity|
- copy.gsub!( entity.value,
+ copy = copy.gsub( entity.value,
"&#{entity.name};" ) if entity.value and
not( entity_filter and entity_filter.include?(entity) )
end
else
- copy.gsub!( EREFERENCE, '&amp;' )
+ copy = copy.gsub( EREFERENCE, '&amp;' )
DocType::DEFAULT_ENTITIES.each_value do |entity|
- copy.gsub!(entity.value, "&#{entity.name};" )
+ copy = copy.gsub(entity.value, "&#{entity.name};" )
end
end
copy