Module: ROXML::XML::NamespacedSearch

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

Instance Method Summary collapse

Instance Method Details

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



12
13
14
15
16
17
18
19
20
21
# File 'lib/roxml/xml/parsers/libxml.rb', line 12

def 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