in reply to Re^3: HTML-Parser: a newbie question: need to extract exactly line 999 out of 5000 files..
in thread HTML-Parser: a newbie question: need to extract exactly line 999 out of 5000 files..

Hello dear morgon:

many thanks for posting! Your code and your ideas are just great!! Really: I am allmost convinced!


use strict; use HTML::TreeBuilder::XPath; my $tree = HTML::TreeBuilder::XPath->new; #use real file name here open(my $fh, "<", "file.html") or die $!; $tree->parse_file($fh); my ($name) = $tree->findnodes(qq{/html/body/table/tr[1]/td[2]}); print $name->as_text;
i have had a look at the ideas of you morgon - that seems to be also an appropiate way. But at the moment i have issues to get the correspodending xpath-expressions: I tried to determine the corresponding xpath-expressions that needs to be filled in the Perl-programme. I need some help here: The 5000 HTML-files all do look the same!


See one of the example sites: http://www.kultusportal-bw.de/servlet/PB/menu/1188427/index.html?COMPLETEHREF=http://www.kultus-bw.de/did_abfrage/detail.php?id=04313488

in the grey shadowed block you see the wanted information: 17 lines that are wanted. Note - i have 5000 different HTML-files - that all are structured in the very same way!

That means i would be happy to have a little template that can be runned with HTML::TokeParser::Simple and DBI.

That would be great!!

Morgon - I would be happy to hear from you

best regards perlbeginner1

http://www.kultusportal-bw.de/servlet/PB/menu/1188427/index.html?COMPLETEHREF=http://www.kultus-bw.de/did_abfrage/schnellsuche.php do a search with *.* -> then you get the result pages
  • Comment on Re^4: HTML-Parser: a newbie question: need to extract exactly line 999 out of 5000 files..
  • Download Code