зеркало из https://github.com/github/ruby.git
* lib/xmlrpc/parser.rb: added new parser class using libxml-ruby gem.
[Feature #9379][ruby-core:59633] * lib/xmlrpc/config.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
22e26d350a
Коммит
8d7fa2291c
|
@ -1,3 +1,9 @@
|
|||
Mon Oct 13 17:53:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||
|
||||
* lib/xmlrpc/parser.rb: added new parser class using libxml-ruby gem.
|
||||
[Feature #9379][ruby-core:59633]
|
||||
* lib/xmlrpc/config.rb: ditto.
|
||||
|
||||
Mon Oct 13 16:32:56 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/find.rb (Find.find): Call to_path for arguments to obtain
|
||||
|
|
3
NEWS
3
NEWS
|
@ -159,6 +159,9 @@ with all sufficient information, see the ChangeLog file.
|
|||
|
||||
http://docs.seattlerb.org/rubygems/History_txt.html#label-2.4.2+%2F+2014-10-01
|
||||
|
||||
* XMLRPC
|
||||
* Added new parser class named LibXMLStreamParser.
|
||||
|
||||
=== Stdlib compatibility issues (excluding feature bug fixes)
|
||||
|
||||
* lib/mathn.rb
|
||||
|
|
|
@ -18,6 +18,7 @@ module XMLRPC # :nodoc:
|
|||
# * XMLParser::XMLStreamParser (fastest)
|
||||
# * XMLParser::REXMLStreamParser
|
||||
# * XMLParser::XMLScanStreamParser
|
||||
# * XMLParser::LibXMLStreamParser
|
||||
DEFAULT_PARSER = XMLParser::REXMLStreamParser
|
||||
|
||||
# enable <code><nil/></code> tag
|
||||
|
|
|
@ -814,12 +814,44 @@ module XMLRPC # :nodoc:
|
|||
end
|
||||
end
|
||||
|
||||
class LibXMLStreamParser < AbstractStreamParser
|
||||
def initialize
|
||||
require 'libxml'
|
||||
@parser_class = LibXMLStreamListener
|
||||
end
|
||||
|
||||
class LibXMLStreamListener
|
||||
include StreamParserMixin
|
||||
|
||||
def on_start_element_ns(name, attributes, prefix, uri, namespaces)
|
||||
startElement(name)
|
||||
end
|
||||
|
||||
def on_end_element_ns(name, prefix, uri)
|
||||
endElement(name)
|
||||
end
|
||||
|
||||
alias :on_characters :character
|
||||
alias :on_cdata_block :character
|
||||
|
||||
def method_missing(*a)
|
||||
end
|
||||
|
||||
def parse(str)
|
||||
parser = LibXML::XML::SaxParser.string(str)
|
||||
parser.callbacks = self
|
||||
parser.parse()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
XMLParser = XMLTreeParser
|
||||
NQXMLParser = NQXMLTreeParser
|
||||
|
||||
Classes = [XMLStreamParser, XMLTreeParser,
|
||||
NQXMLStreamParser, NQXMLTreeParser,
|
||||
REXMLStreamParser, XMLScanStreamParser]
|
||||
REXMLStreamParser, XMLScanStreamParser,
|
||||
LibXMLStreamParser]
|
||||
|
||||
# yields an instance of each installed parser
|
||||
def self.each_installed_parser
|
||||
|
|
Загрузка…
Ссылка в новой задаче