Method: REXML::XPath.match

Defined in:
lib/rexml/xpath.rb

.match(element, path = nil, namespaces = nil, variables = {}, options = {}) ⇒ Object

Returns an array of nodes matching a given XPath.



72
73
74
75
76
77
78
79
# File 'lib/rexml/xpath.rb', line 72

def XPath::match(element, path=nil, namespaces=nil, variables={}, options={})
  parser = XPathParser.new(**options)
  parser.namespaces = namespaces
  parser.variables = variables
  path = "*" unless path
  element = [element] unless element.kind_of? Array
  parser.parse(path,element)
end