summaryrefslogtreecommitdiffstats
path: root/lib/rss/xmlparser.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-16 04:51:15 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-16 04:51:15 +0000
commitce1c652ad2bcd616f2822c11d183ad2ff3ef9b97 (patch)
treee1d33d49cca9875ec515d3ee4ed0dc2686432941 /lib/rss/xmlparser.rb
parentb84c17591829c9f359fe806a9f57e9c99c662f9c (diff)
downloadruby-ce1c652ad2bcd616f2822c11d183ad2ff3ef9b97.tar.gz
ruby-ce1c652ad2bcd616f2822c11d183ad2ff3ef9b97.tar.xz
ruby-ce1c652ad2bcd616f2822c11d183ad2ff3ef9b97.zip
* lib/rss/: untabified.
* test/rss/: untabified. * lib/rss/0.9.rb (RSS::Rss#to_s): inent -> indent. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/xmlparser.rb')
-rw-r--r--lib/rss/xmlparser.rb132
1 files changed, 66 insertions, 66 deletions
diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb
index 7be0dc9a1..64737b821 100644
--- a/lib/rss/xmlparser.rb
+++ b/lib/rss/xmlparser.rb
@@ -1,91 +1,91 @@
begin
- require "xml/parser"
+ require "xml/parser"
rescue LoadError
- require "xmlparser"
+ require "xmlparser"
end
begin
- require "xml/encoding-ja"
+ require "xml/encoding-ja"
rescue LoadError
- require "xmlencoding-ja"
- if defined?(Kconv)
- module XMLEncoding_ja
- class SJISHandler
- include Kconv
- end
- end
- end
+ 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
+ class Parser
+ unless defined?(Error)
+ Error = ::XMLParserError
+ end
+ end
end
module RSS
-
- class REXMLLikeXMLParser < ::XML::Parser
-
- include ::XML::Encoding_ja
+
+ class REXMLLikeXMLParser < ::XML::Parser
+
+ include ::XML::Encoding_ja
- def listener=(listener)
- @listener = listener
- end
+ 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 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 character(data)
+ @listener.text(data)
+ end
- def xmlDecl(version, encoding, standalone)
- @listener.xmldecl(version, encoding, standalone == 1)
- end
+ def xmlDecl(version, encoding, standalone)
+ @listener.xmldecl(version, encoding, standalone == 1)
+ end
- def processingInstruction(target, content)
- @listener.instruction(target, content)
- end
+ def processingInstruction(target, content)
+ @listener.instruction(target, content)
+ end
- end
+ end
- class XMLParserParser < BaseParser
+ class XMLParserParser < BaseParser
- private
- def listener
- XMLParserListener
- end
+ private
+ def listener
+ XMLParserListener
+ end
- 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
+ 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
+ include ListenerMixin
+
+ def xmldecl(version, encoding, standalone)
+ super
+ # Encoding is converted to UTF-8 when XMLParser parses XML.
+ @encoding = 'UTF-8'
+ end
- end
+ end
end