diff options
| author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-07 03:36:38 +0000 |
|---|---|---|
| committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-07 03:36:38 +0000 |
| commit | 07eb740efe5172ed3c9a8fad84088d26d539da01 (patch) | |
| tree | ccf92cc3af99d21f06a5a9c32d02e247abe74592 /lib/rss/parser.rb | |
| parent | 8cdc3778294e77428b05f16ec7a60ff8d1f7775a (diff) | |
| download | ruby-07eb740efe5172ed3c9a8fad84088d26d539da01.tar.gz ruby-07eb740efe5172ed3c9a8fad84088d26d539da01.tar.xz ruby-07eb740efe5172ed3c9a8fad84088d26d539da01.zip | |
* lib/rss/parser.rb, lib/rss/1.0.rb: accepted rdf:resource or
resource attribute in rdf:li.
* test/rss/test_parser.rb: added test for above change.
* lib/rss/dublincore.rb: reverted style.
* lib/rss/xmlparser.rb: normalized XMLParser class hierarchy.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/parser.rb')
| -rw-r--r-- | lib/rss/parser.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb index a04f7959e..e1c61f46a 100644 --- a/lib/rss/parser.rb +++ b/lib/rss/parser.rb @@ -260,19 +260,18 @@ module RSS def start_else_element(local, prefix, attrs, ns) class_name = local[0,1].upcase << local[1..-1] current_class = @last_element.class - begin -# if current_class.const_defined?(class_name) +# begin + if current_class.constants.include?(class_name) next_class = current_class.const_get(class_name) start_have_something_element(local, prefix, attrs, ns, next_class) - rescue NameError -# else +# rescue NameError + else if @ignore_unknown_element @proc_stack.push(nil) else parent = "ROOT ELEMENT???" - begin - parent = current_class::TAG_NAME - rescue NameError + if current_class.const_defined?("TAG_NAME") + parent = current_class.const_get("TAG_NAME") end raise NotExceptedTagError.new(local, parent) end @@ -317,14 +316,18 @@ module RSS klass.get_attributes.each do |a_name, a_uri, required| - if a_uri + if a_uri.is_a?(String) or !a_uri.respond_to?(:include?) + a_uri = [a_uri] + end + unless a_uri == [nil] for prefix, uri in ns - if uri == a_uri + if a_uri.include?(uri) val = attrs["#{prefix}:#{a_name}"] break if val end end - else + end + if val.nil? and a_uri.include?(nil) val = attrs[a_name] end |
