diff -ruN rexml_3.1.5-orig/src/rexml/entity.rb rexml_3.1.5/src/rexml/entity.rb
--- rexml_3.1.5-orig/src/rexml/entity.rb	2006-09-06 17:03:57.000000000 +0200
+++ rexml_3.1.5/src/rexml/entity.rb	2006-09-10 13:47:48.000000000 +0200
@@ -128,7 +128,7 @@
 		#  doctype.entity('yada').value   #-> "nanoo bar nanoo"
 		def value
 			if @value
-				matches = @value.scan(PEREFERENCE_RE)
+				matches = @value.scan(PEREFERENCE_RE).uniq
 				rv = @value.clone
 				if @parent
 					matches.each do |entity_reference|
diff -ruN rexml_3.1.5-orig/src/rexml/parsers/baseparser.rb rexml_3.1.5/src/rexml/parsers/baseparser.rb
--- rexml_3.1.5-orig/src/rexml/parsers/baseparser.rb	2006-09-06 17:03:57.000000000 +0200
+++ rexml_3.1.5/src/rexml/parsers/baseparser.rb	2006-09-10 13:33:19.000000000 +0200
@@ -422,6 +422,7 @@
           [Integer(m)].pack('U*')
         }
         matches.collect!{|x|x[0]}.compact!
+        matches.uniq!
         if matches.size > 0
           matches.each do |entity_reference|
             unless filter and filter.include?(entity_reference)
diff -ruN rexml_3.1.5-orig/src/rexml/text.rb rexml_3.1.5/src/rexml/text.rb
--- rexml_3.1.5-orig/src/rexml/text.rb	2006-09-06 17:03:57.000000000 +0200
+++ rexml_3.1.5/src/rexml/text.rb	2006-09-10 13:23:25.000000000 +0200
@@ -316,6 +316,7 @@
         [Integer(m)].pack('U*')
       }
       matches.collect!{|x|x[0]}.compact!
+      matches.uniq!
       if matches.size > 0
         if doctype
           matches.each do |entity_reference|
