From: "kou (Kouhei Sutou)" Date: 2013-08-11T19:11:31+09:00 Subject: [ruby-dev:47607] [ruby-trunk - Bug #8731] Problems when parsing notation decl and entity decl with REXML::Parsers::SAX2Parser Issue #8731 has been updated by kou (Kouhei Sutou). 報告ありがとうございます。 SAX2Listener#entitydeclは引数を1つだけ受け取るようにしました。非互換な変更になりますが、ドキュメントには引数は配列1つと書いているので、実装のバグだと判断しました。 notationdeclの方は引数の数が固定だったので、配列ではなく個々の引数として受け取るようにしました。こっちはSAX2Listnerが提供するデフォルトのイベントハンドラーメソッドのバグで、呼ばれ方は変更がないので非互換ではないという判断です。 ドキュメントの方ですが、元のドキュメントの通り、"%"は一番最初にくる方が元の宣言と同じになって自然だと思ったので、そっちは実装を直しています。"%"以外のゴミが入っているやつの方はドキュメントを直しました。 ---------------------------------------- Bug #8731: Problems when parsing notation decl and entity decl with REXML::Parsers::SAX2Parser https://bugs.ruby-lang.org/issues/8731#change-41089 Author: ohai (Ippei Obayashi) Status: Closed Priority: Normal Assignee: Category: lib Target version: ruby -v: ruby 2.1.0dev (2013-08-04 trunk 42372) [x86_64-linux] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN 以下のコード(sax2parser_decl_error.rb)を実行すると例外が発生します。 require 'rexml/parsers/sax2parser' require 'rexml/sax2listener' xml = < ]> EOS class Listener include REXML::SAX2Listener end parser = REXML::Parsers::SAX2Parser.new(xml) parser.listen(Listener.new) parser.parse # > test_sax2parser.rb:21:in `entitydecl': wrong number of arguments (3 for 1) (ArgumentError) これは SAX2Parser#handle から SAX2Listener#entitydecl, notationdecl に渡す引数の個数が違っているのが問題です。 添付した rexml-sax2parser-fix.patch で修正されます。ユニットテストは rexml-sax2parser-unittest.patch です。 さらに、rexml-sax2listener-doc.patch でドキュメントの修正をしています。 -- http://bugs.ruby-lang.org/