Good evening morgon and ww. and also hello dear Perl-Monks! great to hear from you!


as parsing this one here: http://www.kultusportal-bw.de/servlet/PB/menu/1188427/index.html?COMPLETEHREF=http://www.kultus-bw.de/did_abfrage/detail.php?id=04313488

i now make use of use some HTML::TableExtract magic: And here i make usage of some circumscances that have to do with the color... conclusion: The Parser-job can be considered to be done yet! Now i have to work on the saving in the database!


see the code that does all the fuzz
#!/usr/bin/perl use strict; use warnings; use HTML::TableExtract; use YAML; my $te = HTML::TableExtract->new( attribs => { border => 0, bgcolor => '#EFEFEF', leftmargin => 15, topmargin => 5, }); $te->parse_file('kultus-bw.html'); my ($table) = $te->tables; for my $row ( $table->rows ) { cleanup(@$row); print "@$row\n"; } sub cleanup { for ( @_ ) { s/\s+//; s/[\xa0 ]+\z//; s/\s+/ /g; } }




see the Output:

Schul-/Behördenname: Abendgymnasium Ostwürttemberg
Schulart: Privatschule (04313488)
Hausadressse: Friedrichstr.70, 73430 Aalen
Postfachadresse: Keine Angabe
Telefon: 07361/680040
Fax: 07361/680040
E-Mail: Keine Angabe
Internet: www.abendgymnasium-ostwuerttemberg.de
ÜbergeordneteDienststelle: Regierungspräsidium Stuttgart Abteilung 7 Schule und Bildung
Schulleitung: Keine Angabe
Stellv.Schulleitung: Keine Angabe
AnzahlSchüler: 259
AnzahlKlassen: 8
AnzahlLehrer: Keine Angabe
Kreis: Ostalbkreis
Schulträger: <Verband/Verein> (Verband/Verein)



See the HTML::TableExtract that does the magic!

Also, the documentation for HTML::TableExtract is available. It does what it says it does: Extracts specific tables from HTML source code. And it does that really well.

BTW: i want (need to do this with another table/site:


see this page: http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=672.8924536341191

Note: click all checkbuttons at the bottom of the site: Then you see a result-page with more than 6400 school-results:
see at the right of the site Weitere Informationen anzeigen you can get detailed information if you click Weitere Informationen anzeigen

9 (or ten lines)

Schuldaten.
Schulnummer:
Amtliche Bezeichnung:
Strasse:
Plz und Ort:
Telefon:
Fax:
E-Mail-Adresse:
Schuldaten ändern]  :(this is UTF8 encoded or what)
Schülergesamtzahl (this is UTF8 encoded or what)


Question: can the HTML::TableExtract can be applied here to!? at the resultpage of more than 6400 shools: http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=672.8924536341191


i guess so!

In reply to Re^2: Xpather running against a simple HTML-document - testing and evaluation by Perlbeginner1
in thread Xpather running against a simple HTML-document - testing and evaluation by Perlbeginner1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.