Class: FeedYamlizer::FeedParser
- Inherits:
-
Object
- Object
- FeedYamlizer::FeedParser
- Defined in:
- lib/feed_yamlizer/feed_parser.rb
Instance Method Summary collapse
-
#initialize(xml, encoding = nil) ⇒ FeedParser
constructor
A new instance of FeedParser.
- #result ⇒ Object
Constructor Details
#initialize(xml, encoding = nil) ⇒ FeedParser
Returns a new instance of FeedParser.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/feed_yamlizer/feed_parser.rb', line 12 def initialize(xml, encoding=nil) @xml = xml @listener = FeedListener.new REXML::Document.parse_stream(@xml, @listener) # TODO this is a hack, do it right rescue REXML::ParseException #puts "REXML::ParseException; converting xml to ascii" @xml = Iconv.conv("US-ASCII//TRANSLIT//IGNORE", "ISO-8859-1", @xml) REXML::Document.parse_stream(@xml, @listener) end |
Instance Method Details
#result ⇒ Object
23 24 25 |
# File 'lib/feed_yamlizer/feed_parser.rb', line 23 def result @listener.result end |