lib/atom/xml/parser.rb in ratom-0.4.1 vs lib/atom/xml/parser.rb in ratom-0.4.2
- old
+ new
@@ -144,21 +144,21 @@
if attribute = self.send(spec.attribute)
if attribute.respond_to?(:to_xml)
node << attribute.to_xml(true, spec.name, spec.options[:namespace], namespace_map)
else
n = XML::Node.new(spec.name)
- n['xmlns'] = spec.options[:namespace]
+ n['xmlns'] = spec.options[:namespace] if spec.options[:namespace]
n << (attribute.is_a?(Time)? attribute.xmlschema : attribute.to_s)
node << n
end
end
else
self.send(spec.attribute).each do |attribute|
if attribute.respond_to?(:to_xml)
node << attribute.to_xml(true, spec.name.singularize, nil, namespace_map)
else
n = XML::Node.new(spec.name.singularize)
- n['xmlns'] = spec.options[:namespace]
+ n['xmlns'] = spec.options[:namespace] if spec.options[:namespace]
n << attribute.to_s
node << n
end
end
end