From d8e3a924111fe46c93a7fc9c0fa00d579ff5ec1c Mon Sep 17 00:00:00 2001 From: hsbt Date: Wed, 2 Mar 2016 06:12:51 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/xmlrpc.rb | 15 ++++-------- lib/xmlrpc/config.rb | 2 -- lib/xmlrpc/parser.rb | 66 +--------------------------------------------------- 3 files changed, 5 insertions(+), 78 deletions(-) (limited to 'lib') diff --git a/lib/xmlrpc.rb b/lib/xmlrpc.rb index 7cda39fc03..c581efee7c 100644 --- a/lib/xmlrpc.rb +++ b/lib/xmlrpc.rb @@ -53,17 +53,15 @@ # * 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 @@ # # # ... # 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 diff --git a/lib/xmlrpc/config.rb b/lib/xmlrpc/config.rb index 4550311f90..8c6ffc68ef 100644 --- a/lib/xmlrpc/config.rb +++ b/lib/xmlrpc/config.rb @@ -13,8 +13,6 @@ module XMLRPC # :nodoc: # === Available parsers # - # * XMLParser::XMLTreeParser - # * XMLParser::XMLStreamParser (fastest) # * XMLParser::REXMLStreamParser # * XMLParser::XMLScanStreamParser # * XMLParser::LibXMLStreamParser diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb index 45b219bbfa..7b11710d37 100644 --- a/lib/xmlrpc/parser.rb +++ b/lib/xmlrpc/parser.rb @@ -567,67 +567,6 @@ module XMLRPC # :nodoc: 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: end end - XMLParser = XMLTreeParser - - Classes = [XMLStreamParser, XMLTreeParser, - REXMLStreamParser, XMLScanStreamParser, + Classes = [REXMLStreamParser, XMLScanStreamParser, LibXMLStreamParser] # yields an instance of each installed parser -- cgit v1.2.3