ruby-changes:41906
From: hsbt <ko1@a...>
Date: Wed, 2 Mar 2016 15:12:59 +0900 (JST)
Subject: [ruby-changes:41906] hsbt:r53980 (trunk): * lib/xmlrpc.rb: Removed broken parser named XMLTreeParser.
hsbt 2016-03-02 15:12:51 +0900 (Wed, 02 Mar 2016) New Revision: 53980 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53980 Log: * lib/xmlrpc.rb: Removed broken parser named XMLTreeParser. Required gem of its parser didn't compile on newer Ruby versions. [fix GH-1271][ruby-core:59590][Bug #9370] * lib/xmlrpc/config.rb: ditto. * lib/xmlrpc/parser.rb: ditto. Modified files: trunk/ChangeLog trunk/lib/xmlrpc/config.rb trunk/lib/xmlrpc/parser.rb trunk/lib/xmlrpc.rb Index: lib/xmlrpc.rb =================================================================== --- lib/xmlrpc.rb (revision 53979) +++ lib/xmlrpc.rb (revision 53980) @@ -53,17 +53,15 @@ https://github.com/ruby/ruby/blob/trunk/lib/xmlrpc.rb#L53 # * HTTPS protocol (SSL) # # * Parsers -# * Expat (XMLParser::XMLStreamParser, XMLParser::XMLTreeParser) -# * Compiled -# * Fastest parser and also uses the least memory -# * See https://rubygems.org/gems/xmlparser # * REXML (XMLParser::REXMLStreamParser) # * Not compiled (pure ruby) # * See ruby standard library # * xml-scan (XMLParser::XMLScanStreamParser) # * Not compiled (pure ruby) # * See https://rubygems.org/gems/xmlscan -# * Fastest parser is Expat's XMLParser::XMLStreamParser! +# * libxml (LibXMLStreamParser) +# * Compiled +# * See https://rubygems.org/gems/libxml-ruby/ # # * General # * possible to choose between XMLParser module (Expat wrapper) and REXML (pure Ruby) parsers @@ -288,14 +286,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/xmlrpc.rb#L286 # # # ... # s = XMLRPC::CGIServer.new -# s.set_parser(XMLRPC::XMLParser::XMLStreamParser.new) +# s.set_parser(XMLRPC::XMLParser::XMLParser.new) # # ... # # -# Note XMLParser::XMLStreamParser (xmlparser gem) is faster and uses less memory than any -# other parser and scales well for large documents. For example for a 0.5 MB XML -# document with many tags, XMLParser::XMLStreamParser is ~18 times as fast as -# XMLParser::XMLTreeParser. -# # You can change the XML-writer by calling method ParserWriterChooseMixin#set_writer. module XMLRPC; end Index: lib/xmlrpc/config.rb =================================================================== --- lib/xmlrpc/config.rb (revision 53979) +++ lib/xmlrpc/config.rb (revision 53980) @@ -13,8 +13,6 @@ module XMLRPC # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/xmlrpc/config.rb#L13 # === Available parsers # - # * XMLParser::XMLTreeParser - # * XMLParser::XMLStreamParser (fastest) # * XMLParser::REXMLStreamParser # * XMLParser::XMLScanStreamParser # * XMLParser::LibXMLStreamParser Index: lib/xmlrpc/parser.rb =================================================================== --- lib/xmlrpc/parser.rb (revision 53979) +++ lib/xmlrpc/parser.rb (revision 53980) @@ -567,67 +567,6 @@ module XMLRPC # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/xmlrpc/parser.rb#L567 end # module StreamParserMixin - class XMLStreamParser < AbstractStreamParser - def initialize - require "xmlparser" - @parser_class = Class.new(::XMLParser) { - include StreamParserMixin - } - end - end # class XMLStreamParser - - class XMLTreeParser < AbstractTreeParser - - def initialize - require "xmltreebuilder" - - # The new XMLParser library (0.6.2+) uses a slightly different DOM implementation. - # The following code removes the differences between both versions. - if defined? XML::DOM::Builder - return if defined? XML::DOM::Node::DOCUMENT # code below has been already executed - klass = XML::DOM::Node - klass.const_set(:DOCUMENT, klass::DOCUMENT_NODE) - klass.const_set(:TEXT, klass::TEXT_NODE) - klass.const_set(:COMMENT, klass::COMMENT_NODE) - klass.const_set(:ELEMENT, klass::ELEMENT_NODE) - end - end - - private - - def _nodeType(node) - tp = node.nodeType - if tp == XML::SimpleTree::Node::TEXT then :TEXT - elsif tp == XML::SimpleTree::Node::COMMENT then :COMMENT - elsif tp == XML::SimpleTree::Node::ELEMENT then :ELEMENT - else :ELSE - end - end - - - def methodResponse_document(node) - assert( node.nodeType == XML::SimpleTree::Node::DOCUMENT ) - hasOnlyOneChild(node, "methodResponse") - - methodResponse(node.firstChild) - end - - def methodCall_document(node) - assert( node.nodeType == XML::SimpleTree::Node::DOCUMENT ) - hasOnlyOneChild(node, "methodCall") - - methodCall(node.firstChild) - end - - def createCleanedTree(str) - doc = XML::SimpleTreeBuilder.new.parse(str) - doc.documentElement.normalize - removeWhitespacesAndComments(doc) - doc - end - - end # class XMLParser - class REXMLStreamParser < AbstractStreamParser def initialize require "rexml/document" @@ -753,10 +692,7 @@ module XMLRPC # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/xmlrpc/parser.rb#L692 end end - XMLParser = XMLTreeParser - - Classes = [XMLStreamParser, XMLTreeParser, - REXMLStreamParser, XMLScanStreamParser, + Classes = [REXMLStreamParser, XMLScanStreamParser, LibXMLStreamParser] # yields an instance of each installed parser Index: ChangeLog =================================================================== --- ChangeLog (revision 53979) +++ ChangeLog (revision 53980) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Mar 2 15:08:33 2016 herwinw <herwin@q...> + + * lib/xmlrpc.rb: Removed broken parser named XMLTreeParser. + Required gem of its parser didn't compile on newer Ruby versions. + [fix GH-1271][ruby-core:59590][Bug #9370] + * lib/xmlrpc/config.rb: ditto. + * lib/xmlrpc/parser.rb: ditto. + Tue Mar 1 11:25:48 2016 Nobuyoshi Nakada <nobu@r...> * lib/fileutils.rb: use keyword arguments instead of option -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/