start_have_something_element(tag_name, prefix, attrs, ns, klass) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rss/parser.rb, line 404
    def start_have_something_element(tag_name, prefix, attrs, ns, klass)

      check_ns(tag_name, prefix, ns, klass.required_uri)

      attributes = {}
      klass.get_attributes.each do |a_name, a_uri, required, element_name|

        if a_uri.is_a?(String) or !a_uri.respond_to?(:include?)
          a_uri = [a_uri]
        end
        unless a_uri == [""]
          for prefix, uri in ns
            if a_uri.include?(uri)
              val = attrs["#{prefix}:#{a_name}"]
              break if val
            end
          end
        end
        if val.nil? and a_uri.include?("")
          val = attrs[a_name]
        end

        if @do_validate and required and val.nil?
          unless a_uri.include?("")
            for prefix, uri in ns
              if a_uri.include?(uri)
                a_name = "#{prefix}:#{a_name}"
              end
            end
          end
          raise MissingAttributeError.new(tag_name, a_name)
        end

        attributes[a_name] = val
      end

      previous = @last_element
      next_element = klass.new(@do_validate, attributes)
      previous.instance_eval {set_next_element(tag_name, next_element)}
      @last_element = next_element
      @proc_stack.push Proc.new { |text, tags|
        p(@last_element.class) if DEBUG
        @last_element.content = text if klass.have_content?
        if @do_validate
          @last_element.validate_for_stream(tags, @ignore_unknown_element)
        end
        @last_element = previous
      }
    end
Register or log in to add new notes.