mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* NEWS (REXML::Parsers::SAX2Parser): Add about this change.
* lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse): Fix wrong number of arguments. Document says "an array of the entity declaration" but it passes two or more arguments. This is a bug but it break backward compatibility. Reported by Ippei Obayashi. [Bug #8731] [ruby-dev:47582] * lib/rexml/sax2listener.rb (REXML::SAX2Listener#entitydecl): ditto. The listener template accepted two arguments. * test/rexml/parser/test_sax2.rb: Add tests for external ID case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7e8b43687c
commit
ce89dedde3
4 changed files with 37 additions and 4 deletions
6
NEWS
6
NEWS
|
@ -182,6 +182,12 @@ with all sufficient information, see the ChangeLog file.
|
||||||
* REXML::Parsers::StreamParser
|
* REXML::Parsers::StreamParser
|
||||||
* Supports "entity" event.
|
* Supports "entity" event.
|
||||||
|
|
||||||
|
* REXML::Parsers::SAX2Parser
|
||||||
|
* Fixes wrong number of arguments of entitydecl event. Document of the event
|
||||||
|
says "an array of the entity declaration" but implemenation passes two
|
||||||
|
or more arguments. It is an implementation bug but it breaks backword
|
||||||
|
compatibility.
|
||||||
|
|
||||||
* REXML::Text
|
* REXML::Text
|
||||||
* REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
|
* REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
|
||||||
* REXML::Text#<< supports not "raw" mode.
|
* REXML::Text#<< supports not "raw" mode.
|
||||||
|
|
|
@ -177,7 +177,7 @@ module REXML
|
||||||
handle( :characters, copy )
|
handle( :characters, copy )
|
||||||
when :entitydecl
|
when :entitydecl
|
||||||
@entities[ event[1] ] = event[2] if event.size == 3
|
@entities[ event[1] ] = event[2] if event.size == 3
|
||||||
handle( *event )
|
handle( event[0], event[1..-1] )
|
||||||
when :processing_instruction, :comment, :attlistdecl,
|
when :processing_instruction, :comment, :attlistdecl,
|
||||||
:elementdecl, :cdata, :notationdecl, :xmldecl
|
:elementdecl, :cdata, :notationdecl, :xmldecl
|
||||||
handle( *event )
|
handle( *event )
|
||||||
|
|
|
@ -70,7 +70,7 @@ module REXML
|
||||||
# ["open-hatch", "PUBLIC", "\"-//Textuality//TEXT Standard open-hatch boilerplate//EN\"", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
|
# ["open-hatch", "PUBLIC", "\"-//Textuality//TEXT Standard open-hatch boilerplate//EN\"", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
|
||||||
# <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
|
# <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
|
||||||
# ["hatch-pic", "SYSTEM", "\"../grafix/OpenHatch.gif\"", "\n\t\t\t\t\t\t\tNDATA gif", "gif"]
|
# ["hatch-pic", "SYSTEM", "\"../grafix/OpenHatch.gif\"", "\n\t\t\t\t\t\t\tNDATA gif", "gif"]
|
||||||
def entitydecl name, decl
|
def entitydecl declaration
|
||||||
end
|
end
|
||||||
# <!NOTATION ...>
|
# <!NOTATION ...>
|
||||||
def notationdecl content
|
def notationdecl content
|
||||||
|
|
|
@ -22,9 +22,9 @@ class TestSAX2Parser < Test::Unit::TestCase
|
||||||
@entity_declarations = []
|
@entity_declarations = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def entitydecl(*args)
|
def entitydecl(declaration)
|
||||||
super
|
super
|
||||||
@entity_declarations << args
|
@entity_declarations << declaration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,6 +51,33 @@ class TestSAX2Parser < Test::Unit::TestCase
|
||||||
INTERNAL_SUBSET
|
INTERNAL_SUBSET
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TestExternlID < self
|
||||||
|
class TestSystem < self
|
||||||
|
def test_without_ndata
|
||||||
|
declaration = [
|
||||||
|
"name",
|
||||||
|
"SYSTEM", "system-literal",
|
||||||
|
]
|
||||||
|
assert_equal([declaration],
|
||||||
|
parse(<<-INTERNAL_SUBSET))
|
||||||
|
<!ENTITY name SYSTEM "system-literal">
|
||||||
|
INTERNAL_SUBSET
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class TestPublic < self
|
||||||
|
def test_without_ndata
|
||||||
|
declaration = [
|
||||||
|
"name",
|
||||||
|
"PUBLIC", "public-literal", "system-literal",
|
||||||
|
]
|
||||||
|
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
|
||||||
|
<!ENTITY name PUBLIC "public-literal" "system-literal">
|
||||||
|
INTERNAL_SUBSET
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue