diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-01 05:43:50 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-01 05:43:50 +0000 |
commit | 1448668244c81cfc720bcdfa93af352a17cc230f () | |
tree | 550af4707b22d099f4d8393e29ef6da424aca813 /lib/rexml/element.rb | |
parent | 96e7713754c477fe98806b905301356371accb68 (diff) |
* lib/rexml: 1.9 from Sam Ruby mentioned in his blog:
<http://intertwingly.net/blog/2007/12/31/Porting-REXML-to-Ruby-1-9> [ruby-core:14639] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rexml/element.rb | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -296,7 +296,7 @@ module REXML raise "First argument must be either an element name, or an Element object" if element.nil? el = @elements.add(element) attrs.each do |key, value| - el.attributes[key]=Attribute.new(key,value,self) end if attrs.kind_of? Hash el end @@ -552,7 +552,11 @@ module REXML def attribute( name, namespace=nil ) prefix = nil - prefix = namespaces.index(namespace) if namespace prefix = nil if prefix == 'xmlns' attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" ) end @@ -704,7 +708,6 @@ module REXML # A private helper method def each_with_something( test, max=0, name=nil ) num = 0 - child=nil @elements.each( name ){ |child| yield child if test.call(child) and num += 1 return if max>0 and num == max @@ -754,7 +757,6 @@ module REXML raise "index (#{index}) must be >= 1" if index < 1 name = literalize(name) if name num = 0 - child = nil @element.find { |child| child.kind_of? Element and (name.nil? ? true : child.has_name?( name )) and @@ -1217,7 +1219,8 @@ module REXML def get_attribute_ns(namespace, name) each_attribute() { |attribute| if name == attribute.name && - namespace == attribute.namespace() return attribute end } |