lib/happymapper.rb in happymapper-0.4.0 vs lib/happymapper.rb in happymapper-0.4.1
- old
+ new
@@ -95,12 +95,14 @@
end
namespace = @namespace || (node.namespaces && node.namespaces.default)
namespace = "#{DEFAULT_NS}:#{namespace}" if namespace
- xpath = root ? '/' : './/'
- xpath += "#{DEFAULT_NS}:" if namespace
- xpath += tag_name
+ unless xpath = options[:xpath]
+ xpath = root ? '/' : './/'
+ xpath += "#{DEFAULT_NS}:" if namespace
+ xpath += tag_name
+ end
nodes = node.find(xpath, Array(namespace))
collection = nodes.collect do |n|
obj = new