1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/bin/perl use strict; use warnings; #use diagnostics; use HTML::TreeBuilder; use XML::LibXML; eval { print "Parsing with XML::LibXML\n"; my $parser = XML::LibXML->new(); my $doc = $parser->parse_string(<<'EOT'); <html> <A> EOT }; print $@ if ($@); eval{ print "\n\nParsing with HTML::TreeBuilder\n"; my $tree = HTML::TreeBuilder->new; # empty tree $tree->parse(<<'EOT'); <html> <A> EOT $tree->dump; }; print $@ if ($@);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/usr/bin/env perl use warnings; use strict; use HTML::TreeBuilder; use XML::LibXML; eval { print "Parsing with XML::LibXML\n"; my $parser = XML::LibXML->new( recover => 2 ); my $doc = $parser->parse_html_string(<<'EOT'); <html> <A> EOT print $doc->toString; }; print $@ if ($@); eval{ print "\n\nParsing with HTML::TreeBuilder\n"; my $tree = HTML::TreeBuilder->new; # empty tree $tree->parse(<<'EOT'); <html> <A> EOT $tree->dump; }; print $@
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#!/usr/bin/env perl use warnings; use strict; use HTML::TreeBuilder; use XML::LibXML; eval { print "Parsing with XML::LibXML\n"; my $parser = XML::LibXML->new( recover => 2 ); my $doc = $parser->parse_html_string(<<'EOT'); <html> <head> <title> Das < ist ein Groesserzeichen</title> <A> EOT print $doc->toString; }; print $@ if ($@); eval{ print "\n\nParsing with HTML::TreeBuilder\n"; my $tree = HTML::TreeBuilder->new; # empty tree $tree->parse(<<'EOT'); <html> <head> <title> Das < ist ein Groesserzeichen</title> <A> EOT $tree->dump; }; print $@
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#!/usr/bin/env perl use warnings; use strict; use HTML::TreeBuilder; # use XML::LibXML; use WebSource::Parser; eval { print "Parsing with XML::LibXML\n"; # my $parser = XML::LibXML->new(); my $parser = WebSource::Parser->new; my $doc = $parser->parse_html_string(<<'EOT'); <html> <A> EOT print $doc->toString; }; print $@ if ($@); eval{ print "\n\nParsing with HTML::TreeBuilder\n"; my $tree = HTML::TreeBuilder->new; # empty tree $tree->parse(<<'EOT'); <html> <A> EOT $tree->dump; }; print $@ if (@)