#!/usr/bin/perl --
use strict;
use warnings;
use HTML::TreeBuilder::XPath;
Main( @ARGV );
exit( 0 );
sub Main {
my $tree = HTML::TreeBuilder::XPath->new;
$tree->parse_file( "the-elevation-group.htm" );
my $XpathXpr = join '|',
q#//div[@id='leftColTop']/div[@class='heading']#,
q#//div[@id='leftColTop']/div[@class='heading']/following-sibling::nod
+e()[1]#,
;
for my $node ( $tree->findnodes_as_strings( $XpathXpr ) ){
print "$node\n\n";
}
}
__END__
Read http://w3schools.com/xpath/default.asp for gentle introduction to xpath.
|