In Files

  • rss/0.9.rb
  • rss/1.0.rb
  • rss/parser.rb

Class/Module Index [+]

Quicksearch

RSS::ListenerMixin

Attributes

do_validate[RW]
ignore_unknown_element[RW]
rss[R]

Public Class Methods

new() click to toggle source
 
               # File rss/parser.rb, line 270
def initialize
  @rss = nil
  @ignore_unknown_element = true
  @do_validate = true
  @ns_stack = [{}]
  @tag_stack = [[]]
  @text_stack = ['']
  @proc_stack = []
  @last_element = nil
  @version = @encoding = @standalone = nil
  @xml_stylesheets = []
end
            

Public Instance Methods

instruction(name, content) click to toggle source
 
               # File rss/parser.rb, line 288
def instruction(name, content)
  if name == "xml-stylesheet"
    params = parse_pi_content(content)
    if params.has_key?("href")
      @xml_stylesheets << XMLStyleSheet.new(*params)
    end
  end
end
            
tag_end(name) click to toggle source
 
               # File rss/parser.rb, line 321
def tag_end(name)
  if DEBUG
    p "end tag #{name}"
    p @tag_stack
  end
  text = @text_stack.pop
  tags = @tag_stack.pop
  pr = @proc_stack.pop
  pr.call(text, tags) unless pr.nil?
  @ns_stack.pop
end
            
tag_start(name, attributes) click to toggle source
 
               # File rss/parser.rb, line 297
def tag_start(name, attributes)
  @text_stack.push('')

  ns = @ns_stack.last.dup
  attrs = {}
  attributes.each do |n, v|
    if /\Axmlns(?:\z|:)/ =~ n
      ns[$POSTMATCH] = v
    else
      attrs[n] = v
    end
  end
  @ns_stack.push(ns)

  prefix, local = split_name(name)
  @tag_stack.last.push([_ns(ns, prefix), local])
  @tag_stack.push([])
  if respond_to?("start_#{local}", true)
    __send__("start_#{local}", local, prefix, attrs, ns.dup)
  else
    start_else_element(local, prefix, attrs, ns.dup)
  end
end
            
text(data) click to toggle source
 
               # File rss/parser.rb, line 333
def text(data)
  @text_stack.last << data
end
            
xmldecl(version, encoding, standalone) click to toggle source

set instance vars for version, encoding, standalone

 
               # File rss/parser.rb, line 284
def xmldecl(version, encoding, standalone)
  @version, @encoding, @standalone = version, encoding, standalone
end
            

Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.

If you are posting code samples in your comments, please wrap them in "<pre><code class="ruby" > ... </code></pre>" markup in order to get syntax highlighting.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file a bug report so that it can be corrected for the next release. Thank you.

blog comments powered by Disqus