Walking through nokogiri and selecting elements with an xpath is fairly easy. I need the vice versa of this, meaning: I need to e.g. call .to_xpath on a nokogiri node to get the full xpath of an element to store it in a record.
Anyone knows a way of doing this?
Easiest way I can think off would be:
Nokogiri::CSS.xpath_for node.css_pathEDIT: you can give
pathmethod a try too.