xml="<root xmlns='url1' xmlns:ns1='url1' xmlns:ns2='url2' xmlns:ns3='url2' a='' ns1:a='' ns1:b='' ns2:c='' ns3:d=''/>"node=REXML::Document.new(xml).rootnode.attribute'a','url1'# => a='' (ns1:a should match)node.attribute'b','url1'# => nil (ns1:b='' should match)node.attribute'c','url2'# => ns2:c='' (OK)node.attribute'd','url2'# => nil (ns3:d='' should match)# Ref:node.attributes.get_attribute_ns'','a'#=> a=''node.attributes.get_attribute_ns'url1','a'#=> ns1:a=''node.attributes.get_attribute_ns'url1','b'#=> ns1:b=''node.attributes.get_attribute_ns'url2','c'#=> ns2:c=''node.attributes.get_attribute_ns'url2','d'#=> ns3:d=''
Result of node.attribute 'b', 'url1' has changed in #335 as a bugfix (DOM spec violation) of Attributes#get_namespace.
node.attribute 'a', 'url1' case is related to #151.
The easiest way to fix this is to simply use:
defattribute(name,namespace=nil)ifnamespaceattributes.get_attribute_ns(namespace,name)elseattributes.get_attribute(name)endend
However, it may introduce incompatibility mentioned in #151.
If this method is fixed as above, I think we don't need to deprecate this method (discussed in #151) because it will be a useful method: a superset of attributs.get_attribute_ns and attributs.get_attribute.
Result of
node.attribute 'b', 'url1'has changed in #335 as a bugfix (DOM spec violation) ofAttributes#get_namespace.node.attribute 'a', 'url1'case is related to #151.The easiest way to fix this is to simply use:
However, it may introduce incompatibility mentioned in #151.
If this method is fixed as above, I think we don't need to deprecate this method (discussed in #151) because it will be a useful method: a superset of
attributs.get_attribute_nsandattributs.get_attribute.