Module: ROXML::XML::NamespacedSearch

Included in:
Document, Node
Defined in:
lib/roxml/xml/parsers/libxml.rb

Instance Method Summary collapse

Instance Method Details

#roxml_search(xpath, roxml_namespaces = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/roxml/xml/parsers/libxml.rb', line 53

def roxml_search(xpath, roxml_namespaces = {})
  if namespaces.default
    roxml_namespaces = {:xmlns => namespaces.default.href}.merge(roxml_namespaces)
  end
  if roxml_namespaces.present?
    find(xpath, roxml_namespaces.map {|prefix, href| [prefix, href].join(':') })
  else
    find(xpath)
  end
end