diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index 7126a12d..b66b0ede 100644 --- a/lib/rexml/parsers/baseparser.rb +++ b/lib/rexml/parsers/baseparser.rb @@ -115,6 +115,7 @@ class BaseParser def initialize( source ) self.stream = source @listeners = [] + @attributes_scanner = StringScanner.new('') end def add_listener( listener ) @@ -601,7 +602,8 @@ def parse_attributes(prefixes, curr_ns) return attributes, closed if raw_attributes.nil? return attributes, closed if raw_attributes.empty? - scanner = StringScanner.new(raw_attributes) + @attributes_scanner.string = raw_attributes + scanner = @attributes_scanner until scanner.eos? if scanner.scan(/\s+/) break if scanner.eos?