lib/atom/element.rb in atom-tools-2.0.2 vs lib/atom/element.rb in atom-tools-2.0.3
- old
+ new
@@ -286,13 +286,17 @@
e.set(name, x)
end
self.on_build do |e,x|
if v = e.get(name)
- unless x.namespaces[ns[0]]
- x.add_namespace *ns
+ n = name.to_s
+
+ if x.namespace != ns[1]
+ x.add_namespace *ns unless x.namespaces[ns[0]]
+ n = "#{ns[0]}:#{n}"
end
- x.attributes["#{ns[0]}:#{name}"] = v.to_s
+
+ x.attributes[n] = v.to_s
end
end
end
# an XML attribute in the Atom namespace