# feed-normalizer-1.5.2 Documentation

## Feed Normalizer

An extensible Ruby wrapper for Atom and RSS parsers.

Feed normalizer wraps various RSS and Atom parsers, and returns a single unified object graph, regardless of the underlying feed format.

## Download

- gem install feed-normalizer

- rubyforge.org/projects/feed-normalizer

- svn co feed-normalizer.googlecode.com/svn/trunk

## Usage

    require 'feed-normalizer'
    require 'open-uri'

    feed = FeedNormalizer::FeedNormalizer.parse open('http://www.iht.com/rss/frontpage.xml')

    feed.title # => "International Herald Tribune"
    feed.url # => "http://www.iht.com/pages/index.php"
    feed.entries.first.url # => "http://www.iht.com/articles/2006/10/03/frontpage/web.1003UN.php"

    feed.class # => FeedNormalizer::Feed
    feed.parser # => "RSS::Parser"

Now read an Atom feed, and the same class is returned, and the same terminology applies:

    feed = FeedNormalizer::FeedNormalizer.parse open('http://www.atomenabled.org/atom.xml')

    feed.title # => "AtomEnabled.org"
    feed.url # => "http://www.atomenabled.org/atom.xml"
    feed.entries.first.url # => "http://www.atomenabled.org/2006/09/moving-toward-atom.php"

The feed representation stays the same, even though a different parser was used.

    feed.class # => FeedNormalizer::Feed
    feed.parser # => "SimpleRSS"

## Cleaning / Sanitizing

    feed.title # => "My Feed > Your Feed"
    feed.entries.first.content # => "<p x='y'>Hello</p><object></object></html>"
    feed.clean!

All elements should now be either clean HTML, or HTML escaped strings.

    feed.title # => "My Feed &gt; Your Feed"
    feed.entries.first.content # => "<p>Hello</p>"

## Extending

Implement a parser wrapper by extending the FeedNormalizer::Parser class and overriding the public methods. Also note the helper methods in the root Parser object to make mapping of output from the particular parser to the Feed object easier.

See FeedNormalizer::RubyRssParser and FeedNormalizer::SimpleRssParser for examples.

## Authors

- Andrew A. Smith (andy@tinnedfruit.org)

This library is released under the terms of the BSD License (see the License.txt file for details).

## Files

- History.txt
- License.txt
- Manifest.txt
- README.txt

## Classes/Modules

- FeedNormalizer
- FeedNormalizer::ElementCleaner
- FeedNormalizer::ElementEquality
- FeedNormalizer::Entry
- FeedNormalizer::Feed
- FeedNormalizer::FeedNormalizer
- FeedNormalizer::HtmlCleaner
- FeedNormalizer::Parser
- FeedNormalizer::ParserRegistry
- FeedNormalizer::RewriteRelativeLinks
- FeedNormalizer::RubyRssParser
- FeedNormalizer::SimpleRssParser
- FeedNormalizer::Singular
- FeedNormalizer::TimeFix
- RSS
- RSS::Rss
- RSS::Rss::Channel
- RSS::Rss::Channel::Item
- RSS::Rss::Channel::Item::Enclosure
- SimpleRSS

## Methods

- ::add_entities — FeedNormalizer::HtmlCleaner
- ::append_or_set! — FeedNormalizer::Parser
- ::clean — FeedNormalizer::HtmlCleaner
- ::dodgy_uri? — FeedNormalizer::HtmlCleaner
- ::feed_id — FeedNormalizer::SimpleRssParser
- ::flatten — FeedNormalizer::HtmlCleaner
- ::image — FeedNormalizer::SimpleRssParser
- ::map_functions! — FeedNormalizer::Parser
- ::new — FeedNormalizer::Entry
- ::new — FeedNormalizer::Feed
- ::overridden_value — FeedNormalizer::SimpleRssParser
- ::package — FeedNormalizer::RubyRssParser
- ::package — FeedNormalizer::SimpleRssParser
- ::parse — FeedNormalizer::SimpleRssParser
- ::parse — FeedNormalizer::Parser
- ::parse — FeedNormalizer::FeedNormalizer
- ::parse — FeedNormalizer::RubyRssParser
- ::parser — FeedNormalizer::RubyRssParser
- ::parser — FeedNormalizer::Parser
- ::parser — FeedNormalizer::SimpleRssParser
- ::parsers — FeedNormalizer::ParserRegistry
- ::priority — FeedNormalizer::SimpleRssParser
- ::priority — FeedNormalizer::RubyRssParser
- ::priority — FeedNormalizer::Parser
- ::register — FeedNormalizer::ParserRegistry
- ::skip — FeedNormalizer::RubyRssParser
- ::unescapeHTML — FeedNormalizer::HtmlCleaner
- #== — FeedNormalizer::ElementEquality
- #== — RSS::Rss::Channel::Item::Enclosure
- #channel — FeedNormalizer::Feed
- #clean! — FeedNormalizer::ElementCleaner
- #clean_content — SimpleRSS
- #content — FeedNormalizer::Entry
- #date_published — FeedNormalizer::Entry
- #diff — FeedNormalizer::ElementEquality
- #eql? — RSS::Rss::Channel::Item::Enclosure
- #eql? — FeedNormalizer::ElementEquality
- #last_updated — FeedNormalizer::Feed
- #method_missing — FeedNormalizer::Singular
- #reparse — FeedNormalizer::TimeFix
- #respond_to? — FeedNormalizer::Singular
- #rewrite_relative_links — FeedNormalizer::RewriteRelativeLinks
- #unescape — SimpleRSS

[Validate]

Generated with the Darkfish Rdoc Generator 2.