~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to lib/rss/parser.rb

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
        @@accessor_bases[uri][tag_name] = accessor_base.chomp("=")
223
223
      end
224
224
 
225
 
      def def_get_text_element(uri, name, file, line)
226
 
        register_uri(uri, name)
227
 
        unless private_instance_methods(false).include?("start_#{name}".to_sym)
228
 
          module_eval(<<-EOT, file, line)
229
 
          def start_#{name}(name, prefix, attrs, ns)
 
225
      def def_get_text_element(uri, element_name, file, line)
 
226
        register_uri(uri, element_name)
 
227
        method_name = "start_#{element_name}"
 
228
        unless private_method_defined?(method_name)
 
229
          define_method(method_name) do |name, prefix, attrs, ns|
230
230
            uri = _ns(ns, prefix)
231
 
            if self.class.uri_registered?(uri, #{name.inspect})
 
231
            if self.class.uri_registered?(uri, element_name)
232
232
              start_get_text_element(name, prefix, ns, uri)
233
233
            else
234
234
              start_else_element(name, prefix, attrs, ns)
235
235
            end
236
236
          end
237
 
          EOT
238
 
          __send!("private", "start_#{name}")
 
237
          private(method_name)
239
238
        end
240
239
      end
241
 
 
242
240
    end
243
 
 
244
241
  end
245
242
 
246
243
  module ListenerMixin
460
457
 
461
458
      previous = @last_element
462
459
      next_element = klass.new(@do_validate, attributes)
463
 
      previous.__send!(:set_next_element, tag_name, next_element)
 
460
      previous.set_next_element(tag_name, next_element)
464
461
      @last_element = next_element
465
462
      @last_element.parent = previous if klass.need_parent?
466
463
      @xml_child_mode = @last_element.have_xml_content?