NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Possibly: (Score:1)
Are you asking about XML::LibXML::Node [cpan.org]’s
nodePathmethod?Re: (Score:1)
More or less what I was going to suggest.
Keep in mind that 'nodePath' will return something like:
/html/body/div[3]/table/tr[2]/td[5]Which, while correct, might not be the most flexible specification... maybe you really wanted:
/html/body/div[h2='The table']/table/tr[td[1]='this row']/td[position()=../../tr[1]/td[.='this column']/position()]Re: (Score:2)
I might want the module to generate multiple possible XPath expressions so that the user can pick, to generate the scraper thing that's most reliable.
Re: (Score:1)
You’ll run into combinatorial explosion for even a relatively short path. There are extremely many ways to address a single element.
I guess what you want, given your comparison with Template::Extract, is a way to accept multiple nodes and then ask for the strictest possible XPath expression (including shared attribute values on any ancestral elements etc) that matches them all.
Hmm, that would be cool.
Re: (Score:2)