diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb index 79838528..f12494d3 100644 --- a/lib/rexml/parsers/sax2parser.rb +++ b/lib/rexml/parsers/sax2parser.rb @@ -157,7 +157,7 @@ def parse ob.end_element( uri, local, event[1] ) } if listeners - namespace_mapping = @namespace_stack.pop + namespace_mapping = @namespace_stack.pop if procs or listeners # find the observers for namespaces procs = get_procs( :end_prefix_mapping, event[1] ) listeners = get_listeners( :end_prefix_mapping, event[1] ) diff --git a/test/test_sax.rb b/test/test_sax.rb index caec983b..9fa27713 100644 --- a/test/test_sax.rb +++ b/test/test_sax.rb @@ -7,6 +7,12 @@ module REXMLTests class SAX2Tester < Test::Unit::TestCase include Helper::Fixture include REXML + + def test_without_listien + p = Parsers::SAX2Parser.new "" + p.parse + end + def test_characters d = Document.new( "@blah@" ) txt = d.root.text