diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
commit | d0233291bc8a5068e52c69c210e5979e5324b5bc (patch) | |
tree | 7d9459449c33792c63eeb7baa071e76352e0baab /trunk/lib/rss/xmlparser.rb | |
parent | 0dc342de848a642ecce8db697b8fecd83a63e117 (diff) | |
parent | 72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff) |
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/lib/rss/xmlparser.rb')
-rw-r--r-- | trunk/lib/rss/xmlparser.rb | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/trunk/lib/rss/xmlparser.rb b/trunk/lib/rss/xmlparser.rb deleted file mode 100644 index 3dfe7d461a..0000000000 --- a/trunk/lib/rss/xmlparser.rb +++ /dev/null @@ -1,93 +0,0 @@ -begin - require "xml/parser" -rescue LoadError - require "xmlparser" -end - -begin - require "xml/encoding-ja" -rescue LoadError - require "xmlencoding-ja" - if defined?(Kconv) - module XMLEncoding_ja - class SJISHandler - include Kconv - end - end - end -end - -module XML - class Parser - unless defined?(Error) - Error = ::XMLParserError - end - end -end - -module RSS - - class REXMLLikeXMLParser < ::XML::Parser - - include ::XML::Encoding_ja - - def listener=(listener) - @listener = listener - end - - def startElement(name, attrs) - @listener.tag_start(name, attrs) - end - - def endElement(name) - @listener.tag_end(name) - end - - def character(data) - @listener.text(data) - end - - def xmlDecl(version, encoding, standalone) - @listener.xmldecl(version, encoding, standalone == 1) - end - - def processingInstruction(target, content) - @listener.instruction(target, content) - end - - end - - class XMLParserParser < BaseParser - - class << self - def listener - XMLParserListener - end - end - - private - def _parse - begin - parser = REXMLLikeXMLParser.new - parser.listener = @listener - parser.parse(@rss) - rescue ::XML::Parser::Error => e - raise NotWellFormedError.new(parser.line){e.message} - end - end - - end - - class XMLParserListener < BaseListener - - include ListenerMixin - - def xmldecl(version, encoding, standalone) - super - # Encoding is converted to UTF-8 when XMLParser parses XML. - @encoding = 'UTF-8' - end - - end - -end |