lib/happymapper.rb in nokogiri-happymapper-0.8.0 vs lib/happymapper.rb in nokogiri-happymapper-0.8.1
- old
+ new
@@ -403,10 +403,11 @@
else
'.//'
end
if namespace
return [] unless namespaces.find { |name, _url| ["xmlns:#{namespace}", namespace].include? name }
+
xpath += "#{namespace}:"
end
nodes = []
@@ -672,9 +673,10 @@
# However, we do not want to add the namespace if the namespace is 'xmlns'
# which means that it is the default namespace of the code.
#
def register_namespaces_with_builder(builder)
return unless self.class.instance_variable_get('@registered_namespaces')
+
self.class.instance_variable_get('@registered_namespaces').sort.each do |name, href|
name = nil if name == 'xmlns'
builder.doc.root.add_namespace(name, href)
end
end