Search notes:

Perl module YAPE::HTML

use warnings;
use strict;

use File::Slurp;

use YAPE::HTML;

my $html = read_file('../../HTML/test_01.html');

my $p = YAPE::HTML->new($html, 0);

my $indent_ = 0;

while (my $chunk = $p->next) {

  if ($chunk->type eq 'tag') {

    print '  ' x $indent_ . "Tag, ", $chunk->{TAG}, "\n";

    $indent_ ++;
  }
  elsif ($chunk->type eq 'closetag') {

    $indent_ --;

    print '  ' x $indent_ . "Close-Tag, ", $chunk->{TAG}, "\n";
  }
  elsif ($chunk->type eq 'text') {

    my $text = $chunk->{TEXT};
    $text =~ s/\n/ /g;
    $text =~ s/\s+/ /g;
    print '  ' x $indent_ . "Text " . $text . "\n";
  }
  elsif ($chunk->type eq 'comment') {

    print '  ' x $indent_ . "Comment: ", $chunk->{TEXT} . "\n";
  }
  elsif ($chunk->type eq 'dtd') {

    print "DTD " . join "-", keys %$chunk, "\n";
  }
  else {
    die "\n\n" . $chunk->type . "\n\n";
  }
}
Github repository PerlModules, path: /YAPE/HTML/script.pl

See also

HTML::TreeBuilder, HTML::TokeParser, HTML::Parser
Perl modules

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759407806, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/YAPE/HTML/index(86): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78