mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
a400386dbe
commit
d8e3a92411
4 changed files with 13 additions and 78 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Wed Mar 2 15:08:33 2016 herwinw <herwin@quarantainenet.nl>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Tue Mar 1 11:25:48 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/fileutils.rb: use keyword arguments instead of option
|
* lib/fileutils.rb: use keyword arguments instead of option
|
||||||
|
|
|
@ -53,17 +53,15 @@
|
||||||
# * HTTPS protocol (SSL)
|
# * HTTPS protocol (SSL)
|
||||||
#
|
#
|
||||||
# * Parsers
|
# * Parsers
|
||||||
# * Expat (XMLParser::XMLStreamParser, XMLParser::XMLTreeParser)
|
|
||||||
# * Compiled
|
|
||||||
# * Fastest parser and also uses the least memory
|
|
||||||
# * See https://rubygems.org/gems/xmlparser
|
|
||||||
# * REXML (XMLParser::REXMLStreamParser)
|
# * REXML (XMLParser::REXMLStreamParser)
|
||||||
# * Not compiled (pure ruby)
|
# * Not compiled (pure ruby)
|
||||||
# * See ruby standard library
|
# * See ruby standard library
|
||||||
# * xml-scan (XMLParser::XMLScanStreamParser)
|
# * xml-scan (XMLParser::XMLScanStreamParser)
|
||||||
# * Not compiled (pure ruby)
|
# * Not compiled (pure ruby)
|
||||||
# * See https://rubygems.org/gems/xmlscan
|
# * See https://rubygems.org/gems/xmlscan
|
||||||
# * Fastest parser is Expat's XMLParser::XMLStreamParser!
|
# * libxml (LibXMLStreamParser)
|
||||||
|
# * Compiled
|
||||||
|
# * See https://rubygems.org/gems/libxml-ruby/
|
||||||
#
|
#
|
||||||
# * General
|
# * General
|
||||||
# * possible to choose between XMLParser module (Expat wrapper) and REXML (pure Ruby) parsers
|
# * possible to choose between XMLParser module (Expat wrapper) and REXML (pure Ruby) parsers
|
||||||
|
@ -288,14 +286,9 @@
|
||||||
#
|
#
|
||||||
# # ...
|
# # ...
|
||||||
# s = XMLRPC::CGIServer.new
|
# 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.
|
# You can change the XML-writer by calling method ParserWriterChooseMixin#set_writer.
|
||||||
module XMLRPC; end
|
module XMLRPC; end
|
||||||
|
|
|
@ -13,8 +13,6 @@ module XMLRPC # :nodoc:
|
||||||
|
|
||||||
# === Available parsers
|
# === Available parsers
|
||||||
#
|
#
|
||||||
# * XMLParser::XMLTreeParser
|
|
||||||
# * XMLParser::XMLStreamParser (fastest)
|
|
||||||
# * XMLParser::REXMLStreamParser
|
# * XMLParser::REXMLStreamParser
|
||||||
# * XMLParser::XMLScanStreamParser
|
# * XMLParser::XMLScanStreamParser
|
||||||
# * XMLParser::LibXMLStreamParser
|
# * XMLParser::LibXMLStreamParser
|
||||||
|
|
|
@ -567,67 +567,6 @@ module XMLRPC # :nodoc:
|
||||||
|
|
||||||
end # module StreamParserMixin
|
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
|
class REXMLStreamParser < AbstractStreamParser
|
||||||
def initialize
|
def initialize
|
||||||
require "rexml/document"
|
require "rexml/document"
|
||||||
|
@ -753,10 +692,7 @@ module XMLRPC # :nodoc:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
XMLParser = XMLTreeParser
|
Classes = [REXMLStreamParser, XMLScanStreamParser,
|
||||||
|
|
||||||
Classes = [XMLStreamParser, XMLTreeParser,
|
|
||||||
REXMLStreamParser, XMLScanStreamParser,
|
|
||||||
LibXMLStreamParser]
|
LibXMLStreamParser]
|
||||||
|
|
||||||
# yields an instance of each installed parser
|
# yields an instance of each installed parser
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue