mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/xmlrpc.rb: Removed broken parser named XMLScanStreamParser.
It's not works with current Ruby version. [fix GH-1271][ruby-core:59588][Bug #9369] * lib/xmlrpc/config.rb: ditto. * lib/xmlrpc/parser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d8e3a92411
commit
a2845a44f8
4 changed files with 9 additions and 75 deletions
|
@ -1,3 +1,11 @@
|
|||
Wed Mar 2 15:13:33 2016 herwinw <herwin@quarantainenet.nl>
|
||||
|
||||
* lib/xmlrpc.rb: Removed broken parser named XMLScanStreamParser.
|
||||
It's not works with current Ruby version.
|
||||
[fix GH-1271][ruby-core:59588][Bug #9369]
|
||||
* lib/xmlrpc/config.rb: ditto.
|
||||
* lib/xmlrpc/parser.rb: ditto.
|
||||
|
||||
Wed Mar 2 15:08:33 2016 herwinw <herwin@quarantainenet.nl>
|
||||
|
||||
* lib/xmlrpc.rb: Removed broken parser named XMLTreeParser.
|
||||
|
|
|
@ -56,9 +56,6 @@
|
|||
# * 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
|
||||
# * libxml (LibXMLStreamParser)
|
||||
# * Compiled
|
||||
# * See https://rubygems.org/gems/libxml-ruby/
|
||||
|
|
|
@ -14,7 +14,6 @@ module XMLRPC # :nodoc:
|
|||
# === Available parsers
|
||||
#
|
||||
# * XMLParser::REXMLStreamParser
|
||||
# * XMLParser::XMLScanStreamParser
|
||||
# * XMLParser::LibXMLStreamParser
|
||||
DEFAULT_PARSER = XMLParser::REXMLStreamParser
|
||||
|
||||
|
|
|
@ -592,75 +592,6 @@ module XMLRPC # :nodoc:
|
|||
|
||||
end
|
||||
|
||||
class XMLScanStreamParser < AbstractStreamParser
|
||||
def initialize
|
||||
require "xmlscan/parser"
|
||||
@parser_class = XMLScanParser
|
||||
end
|
||||
|
||||
class XMLScanParser
|
||||
include StreamParserMixin
|
||||
|
||||
Entities = {
|
||||
"lt" => "<",
|
||||
"gt" => ">",
|
||||
"amp" => "&",
|
||||
"quot" => '"',
|
||||
"apos" => "'"
|
||||
}
|
||||
|
||||
def parse(str)
|
||||
parser = XMLScan::XMLParser.new(self)
|
||||
parser.parse(str)
|
||||
end
|
||||
|
||||
alias :on_stag :startElement
|
||||
alias :on_etag :endElement
|
||||
|
||||
def on_stag_end(name); end
|
||||
|
||||
def on_stag_end_empty(name)
|
||||
startElement(name)
|
||||
endElement(name)
|
||||
end
|
||||
|
||||
def on_chardata(str)
|
||||
character(str)
|
||||
end
|
||||
|
||||
def on_cdata(str)
|
||||
character(str)
|
||||
end
|
||||
|
||||
def on_entityref(ent)
|
||||
str = Entities[ent]
|
||||
if str
|
||||
character(str)
|
||||
else
|
||||
raise "unknown entity"
|
||||
end
|
||||
end
|
||||
|
||||
def on_charref(code)
|
||||
character(code.chr)
|
||||
end
|
||||
|
||||
def on_charref_hex(code)
|
||||
character(code.chr)
|
||||
end
|
||||
|
||||
def method_missing(*a)
|
||||
end
|
||||
|
||||
# TODO: call/implement?
|
||||
# valid_name?
|
||||
# valid_chardata?
|
||||
# valid_char?
|
||||
# parse_error
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
class LibXMLStreamParser < AbstractStreamParser
|
||||
def initialize
|
||||
require 'libxml'
|
||||
|
@ -692,8 +623,7 @@ module XMLRPC # :nodoc:
|
|||
end
|
||||
end
|
||||
|
||||
Classes = [REXMLStreamParser, XMLScanStreamParser,
|
||||
LibXMLStreamParser]
|
||||
Classes = [REXMLStreamParser, LibXMLStreamParser]
|
||||
|
||||
# yields an instance of each installed parser
|
||||
def self.each_installed_parser
|
||||
|
|
Loading…
Add table
Reference in a new issue