From: Li Chen Date: 2008-08-13T03:03:32+09:00 Subject: Hpricot and xpath Hi all, I want to find the path to a tag I am interested using hpricot. According to the document and examples I think I should use #xpath method. I expect that ruby will return the path as this: "/tag1/tag2/div[@id='header']" but I get the following info: tag1.rb:4: undefined method `xpath' for nil:NilClass (NoMethodError) I wonder why method #xpath is not defined? Thanks, Li ########################################### Here is my code: require 'hpricot' doc=Hpricot(open('tag.txt')) puts doc puts doc.at("header").xpath() ########tag.txt##########