match(element, path, namespaces=EMPTY_HASH) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rexml/quickpath.rb, line 23
    def QuickPath::match element, path, namespaces=EMPTY_HASH
      raise "nil is not a valid xpath" unless path
      results = nil
      Functions::namespace_context = namespaces
      case path
      when /^\/([^\/]|$)/
        # match on root
        path = path[1..-1]
        return [element.root.parent] if path == ''
        results = filter([element.root], path)
      when /^[-\w]*::/
        results = filter([element], path)
      when /^\*/
        results = filter(element.to_a, path)
      when /^[\[!\w:]/
        # match on child
        children = element.to_a
        results = filter(children, path)
        results = filter([element], path)
      return results
Register or log in to add new notes.