mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rexml/parsers/streamparser.rb
(REXML::Parsers::StreamParser#parse): Add "entity" event support to listener. [Bug #8689] [ruby-dev:47542] Reported by Ippei Obayashi. * test/rexml/test_stream.rb (StreamTester#entity): Add a test for the above case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
41f864faab
commit
75a138732e
3 changed files with 36 additions and 0 deletions
|
@ -1,3 +1,12 @@
|
|||
Fri Jul 26 23:14:31 2013 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rexml/parsers/streamparser.rb
|
||||
(REXML::Parsers::StreamParser#parse): Add "entity" event support to
|
||||
listener. [Bug #8689] [ruby-dev:47542]
|
||||
Reported by Ippei Obayashi.
|
||||
* test/rexml/test_stream.rb (StreamTester#entity): Add a test for
|
||||
the above case.
|
||||
|
||||
Fri Jul 26 23:05:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_yylex): separate numeric literal from succeeding
|
||||
|
|
|
@ -38,6 +38,10 @@ module REXML
|
|||
@listener.send( event[0].to_s, *event[1..-1] )
|
||||
when :entitydecl, :notationdecl
|
||||
@listener.send( event[0].to_s, event[1..-1] )
|
||||
when :externalentity
|
||||
entity_reference = event[1]
|
||||
content = entity_reference.gsub(/\A%|;\z/, "")
|
||||
@listener.entity(content)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -63,6 +63,29 @@ class StreamTester < Test::Unit::TestCase
|
|||
assert( listener.events[:elementdecl] )
|
||||
assert( listener.events[:notationdecl] )
|
||||
end
|
||||
|
||||
def test_entity
|
||||
listener = MyListener.new
|
||||
class << listener
|
||||
attr_accessor :entities
|
||||
def entity(content)
|
||||
@entities << content
|
||||
end
|
||||
end
|
||||
listener.entities = []
|
||||
|
||||
source = StringIO.new(<<-XML)
|
||||
<!DOCTYPE root [
|
||||
<!ENTITY % ISOLat2
|
||||
SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
|
||||
%ISOLat2;
|
||||
]>
|
||||
<root/>
|
||||
XML
|
||||
REXML::Document.parse_stream(source, listener)
|
||||
|
||||
assert_equal(["ISOLat2"], listener.entities)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue