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 | 8dfa6fb0a80d633d71987f06462823ca13b67be8 (patch) | |
tree | ccf92cc3af99d21f06a5a9c32d02e247abe74592 /lib/rss/parser.rb | |
parent | 4ded52b623ebd1b3de12db82f8b54cc156c1fd28 (diff) | |
download | ruby-8dfa6fb0a80d633d71987f06462823ca13b67be8.tar.gz |
* 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: svn+ssh://ci.ruby-lang.org/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 a04f7959ec..e1c61f46ae 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 |