diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index bc59bcd..c79de0e 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -211,8 +211,9 @@ def pull_event
#STDERR.puts @source.encoding
#STDERR.puts "BUFFER = #{@source.buffer.inspect}"
if @document_status == nil
+ start_position = @source.position
if @source.match("", true)
- return process_instruction
+ return process_instruction(start_position)
elsif @source.match("/um, true)[1] ]
@@ -224,7 +225,7 @@ def pull_event
else
message = "#{base_error_message}: invalid name"
end
- @source.string = "/um, true)
@@ -325,7 +327,7 @@ def pull_event
else
message = "#{base_error_message}: invalid name"
end
- @source.string = " "
scanner << match_data[1]
- scanner.pos = pos
+ scanner.pos = start_position
closed = !match_data[2].nil?
next
end
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb
index 9eeba27..81d9645 100644
--- a/lib/rexml/source.rb
+++ b/lib/rexml/source.rb
@@ -76,8 +76,12 @@ def match(pattern, cons=false)
end
end
- def string=(string)
- @scanner.string = string
+ def position
+ @scanner.pos
+ end
+
+ def position=(pos)
+ @scanner.pos = pos
end
# @return true if the Source is exhausted
diff --git a/test/parse/test_notation_declaration.rb b/test/parse/test_notation_declaration.rb
index 19a0536..9e81b6a 100644
--- a/test/parse/test_notation_declaration.rb
+++ b/test/parse/test_notation_declaration.rb
@@ -35,7 +35,7 @@ def test_no_name
Line: 5
Position: 72
Last 80 unconsumed characters:
- ]>
+ ]>
DETAIL
end