Class: XML::Feed::Parser::Rss

Inherits:
Base
  • Object
show all
Defined in:
lib/xml/libxml/feed/parsers/rss.rb

Defined Under Namespace

Modules: Common Classes: Channel, Item

Instance Attribute Summary

Attributes inherited from Base

#doc, #validated, #version, #xml

Instance Method Summary collapse

Constructor Details

#initialize(version, io, auto_validate = true) ⇒ Rss

Returns a new instance of Rss.



8
9
10
# File 'lib/xml/libxml/feed/parsers/rss.rb', line 8

def initialize(version, io, auto_validate=true)
    super
end

Instance Method Details

#channelObject



23
24
25
26
27
28
29
30
# File 'lib/xml/libxml/feed/parsers/rss.rb', line 23

def channel
    channels = []
    @doc.find('/rss/channel').each do |x|
        channels.push(Channel.new(x))
    end

    return channels
end

#validate!Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/xml/libxml/feed/parsers/rss.rb', line 12

def validate!
    case @version
    when '2.0'
        validate_20
    else
        validation_error "Validating RSS version #{@version} is not supported (yet!)"
    end

    @validated = true
end