Class: Syndication::RSS::Parser

Inherits:
AbstractParser show all
Includes:
REXML::StreamListener
Defined in:
lib/syndication/rss.rb

Overview

A parser for RSS feeds. See Syndication::Parser in common.rb for the abstract class this specializes.

Constant Summary

CLASS_FOR_TAG =

:stopdoc: A hash of tags which require the creation of new objects, and the class to use for creating the object.

{
  'item' => Item,
  'entry' => Item,
  'image' => Image,
  'channel' => Channel,
  'cloud' => Cloud,
  'textinput' => TextInput,
  'textInput' => TextInput,
  'enclosure' => Enclosure
}

Constants inherited from AbstractParser

AbstractParser::KNOWN_NAMESPACES

Instance Method Summary (collapse)

Methods inherited from AbstractParser

#cdata, #define_namespace, #end_tag, #handle_namespace, #initialize, #parse, #store, #tag_end, #tag_start, #text

Constructor Details

This class inherits a constructor from Syndication::AbstractParser

Instance Method Details

- (Object) feed

The most recently parsed feed as a Syndication::RSS::Feed object.



327
328
329
# File 'lib/syndication/rss.rb', line 327

def feed
  return @parsetree
end

- (Object) reset

Reset the parser ready to parse a new feed.



317
318
319
320
321
322
323
324
# File 'lib/syndication/rss.rb', line 317

def reset
  # Set up an empty RSS::Feed object and make it the current object
  @parsetree = Feed.new(nil)
  # Set up the class-for-tag hash
  @class_for_tag = CLASS_FOR_TAG
  # Everything else is common to both kinds of parser
  super
end