# File lib/rexml/xpath.rb, line 22def XPath::firstelement,path=nil,namespaces=nil,variables={}raise"The namespaces argument, if supplied, must be a hash object."unlessnamespaces.nil?ornamespaces.kind_of?(Hash)raise"The variables argument, if supplied, must be a hash object."unlessvariables.kind_of?(Hash)parser=XPathParser.newparser.namespaces=namespacesparser.variables=variablespath="*"unlesspathelement=[element]unlesselement.kind_of?Arrayparser.parse(path,element).flatten[0]end