Google

def XPath::first element, path=nil, namespaces=nil parser = XPathParser.new parser.namespaces = namespaces path = "*" unless path element = [element] unless element.kind_of? Array parser.parse(path, element, true)[0] end