mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/xmlrpc.rb: Removed references to NQXML. It's obsoleted parser.
[fix GH-1245][ruby-core:59593][Feature #9371] * lib/xmlrpc/config.rb: ditto. * lib/xmlrpc/parser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
379c3b8b24
commit
0676ce8739
4 changed files with 10 additions and 111 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Feb 26 11:21:41 2016 herwinw <herwin@quarantainenet.nl>
|
||||
|
||||
* lib/xmlrpc.rb: Removed references to NQXML. It's obsoleted parser.
|
||||
[fix GH-1245][ruby-core:59593][Feature #9371]
|
||||
* lib/xmlrpc/config.rb: ditto.
|
||||
* lib/xmlrpc/parser.rb: ditto.
|
||||
|
||||
Fri Feb 26 11:10:19 2016 Rick Salevsky <rsalevsky@suse.com>
|
||||
|
||||
* lib/tmpdir.rb: Unify to coding-style for method definition.
|
||||
|
|
|
@ -53,10 +53,6 @@
|
|||
# * HTTPS protocol (SSL)
|
||||
#
|
||||
# * Parsers
|
||||
# * NQXML (XMLParser::NQXMLStreamParser, XMLParser::NQXMLTreeParser)
|
||||
# * Not compiled (pure ruby)
|
||||
# * Note: NQXML's website recommends rexml and isn't available on rubygems.org
|
||||
# * See http://nqxml.sourceforge.net/
|
||||
# * Expat (XMLParser::XMLStreamParser, XMLParser::XMLTreeParser)
|
||||
# * Compiled
|
||||
# * Fastest parser and also uses the least memory
|
||||
|
@ -70,7 +66,7 @@
|
|||
# * Fastest parser is Expat's XMLParser::XMLStreamParser!
|
||||
#
|
||||
# * General
|
||||
# * possible to choose between XMLParser module (Expat wrapper) and REXML/NQXML (pure Ruby) parsers
|
||||
# * possible to choose between XMLParser module (Expat wrapper) and REXML (pure Ruby) parsers
|
||||
# * Marshalling Ruby objects to Hashes and reconstruct them later from a Hash
|
||||
# * SandStorm component architecture XMLRPC::Client interface
|
||||
#
|
||||
|
@ -295,18 +291,11 @@
|
|||
# s.set_parser(XMLRPC::XMLParser::XMLStreamParser.new)
|
||||
# # ...
|
||||
#
|
||||
# or:
|
||||
#
|
||||
# # ...
|
||||
# server = XMLRPC::Server.new(8080)
|
||||
# server.set_parser(XMLRPC::XMLParser::NQXMLParser.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 ~350 (!) times faster than
|
||||
# XMLParser::NQXMLTreeParser and still ~18 times as fast as XMLParser::XMLTreeParser.
|
||||
# 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
|
||||
|
|
|
@ -13,8 +13,6 @@ module XMLRPC # :nodoc:
|
|||
|
||||
# === Available parsers
|
||||
#
|
||||
# * XMLParser::NQXMLTreeParser
|
||||
# * XMLParser::NQXMLStreamParser
|
||||
# * XMLParser::XMLTreeParser
|
||||
# * XMLParser::XMLStreamParser (fastest)
|
||||
# * XMLParser::REXMLStreamParser
|
||||
|
|
|
@ -10,42 +10,6 @@ require "xmlrpc/base64"
|
|||
require "xmlrpc/datetime"
|
||||
|
||||
|
||||
module NQXML
|
||||
class Node
|
||||
|
||||
def removeChild(node)
|
||||
@children.delete(node)
|
||||
end
|
||||
def childNodes
|
||||
@children
|
||||
end
|
||||
def hasChildNodes
|
||||
not @children.empty?
|
||||
end
|
||||
def [] (index)
|
||||
@children[index]
|
||||
end
|
||||
|
||||
def nodeType
|
||||
if @entity.instance_of? NQXML::Text then :TEXT
|
||||
elsif @entity.instance_of? NQXML::Comment then :COMMENT
|
||||
#elsif @entity.instance_of? NQXML::Element then :ELEMENT
|
||||
elsif @entity.instance_of? NQXML::Tag then :ELEMENT
|
||||
else :ELSE
|
||||
end
|
||||
end
|
||||
|
||||
def nodeValue
|
||||
#TODO: error when wrong Entity-type
|
||||
@entity.text
|
||||
end
|
||||
def nodeName
|
||||
#TODO: error when wrong Entity-type
|
||||
@entity.name
|
||||
end
|
||||
end # class Node
|
||||
end # module NQXML
|
||||
|
||||
module XMLRPC # :nodoc:
|
||||
|
||||
# Raised when the remote procedure returns a fault-structure, which has two
|
||||
|
@ -612,35 +576,6 @@ module XMLRPC # :nodoc:
|
|||
end
|
||||
end # class XMLStreamParser
|
||||
|
||||
class NQXMLStreamParser < AbstractStreamParser
|
||||
def initialize
|
||||
require "nqxml/streamingparser"
|
||||
@parser_class = XMLRPCParser
|
||||
end
|
||||
|
||||
class XMLRPCParser
|
||||
include StreamParserMixin
|
||||
|
||||
def parse(str)
|
||||
parser = NQXML::StreamingParser.new(str)
|
||||
parser.each do |ele|
|
||||
case ele
|
||||
when NQXML::Text
|
||||
@data = ele.text
|
||||
#character(ele.text)
|
||||
when NQXML::Tag
|
||||
if ele.isTagEnd
|
||||
endElement(ele.name)
|
||||
else
|
||||
startElement(ele.name, ele.attrs)
|
||||
end
|
||||
end
|
||||
end # do
|
||||
end # method parse
|
||||
end # class XMLRPCParser
|
||||
|
||||
end # class NQXMLStreamParser
|
||||
|
||||
class XMLTreeParser < AbstractTreeParser
|
||||
|
||||
def initialize
|
||||
|
@ -693,34 +628,6 @@ module XMLRPC # :nodoc:
|
|||
|
||||
end # class XMLParser
|
||||
|
||||
class NQXMLTreeParser < AbstractTreeParser
|
||||
|
||||
def initialize
|
||||
require "nqxml/treeparser"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def _nodeType(node)
|
||||
node.nodeType
|
||||
end
|
||||
|
||||
def methodResponse_document(node)
|
||||
methodResponse(node)
|
||||
end
|
||||
|
||||
def methodCall_document(node)
|
||||
methodCall(node)
|
||||
end
|
||||
|
||||
def createCleanedTree(str)
|
||||
doc = ::NQXML::TreeParser.new(str).document.rootNode
|
||||
removeWhitespacesAndComments(doc)
|
||||
doc
|
||||
end
|
||||
|
||||
end # class NQXMLTreeParser
|
||||
|
||||
class REXMLStreamParser < AbstractStreamParser
|
||||
def initialize
|
||||
require "rexml/document"
|
||||
|
@ -847,10 +754,8 @@ module XMLRPC # :nodoc:
|
|||
end
|
||||
|
||||
XMLParser = XMLTreeParser
|
||||
NQXMLParser = NQXMLTreeParser
|
||||
|
||||
Classes = [XMLStreamParser, XMLTreeParser,
|
||||
NQXMLStreamParser, NQXMLTreeParser,
|
||||
REXMLStreamParser, XMLScanStreamParser,
|
||||
LibXMLStreamParser]
|
||||
|
||||
|
|
Loading…
Reference in a new issue