Hpricot and Namespaces/XPath
Friday, September 4th, 2009Until today we were happy users of Hpricot (0.8.1) . Easy to use, nice API, fast (enough)… but today we had to move a project over to Nokogiri.Why? Hpricot does not support XPath with namespaces. Worse: it does not even complain when you use a namespaced XPath query. It just keeps telling you that your XPath ended up in Nirvana and that there is no result.“Hey pal, you are using namespaces in XPath and i do not understand this” would have been a nice message.Since Hpricot does properly parse the namespaces, you can work around the problem using the at (aliased as %) method. But we need full XPath support hence the switch to Nokogiri.Some links i came across while researching the issue:
