1HTML::TreeBuilder::LibXUMsLe(r3pCmo)ntributed Perl DocumHeTnMtLa:t:iTorneeBuilder::LibXML(3pm)
2
3
4
6 HTML::TreeBuilder::LibXML - HTML::TreeBuilder and XPath compatible
7 interface with libxml
8
10 use HTML::TreeBuilder::LibXML;
11
12 my $tree = HTML::TreeBuilder::LibXML->new;
13 $tree->parse($html);
14 $tree->eof;
15
16 # $tree and $node compatible to HTML::Element
17 my @nodes = $tree->findvalue($xpath);
18 for my $node (@nodes) {
19 print $node->tag;
20 my %attr = $node->all_external_attr;
21 }
22
23 HTML::TreeBuilder::LibXML->replace_original(); # replace HTML::TreeBuilder::XPath->new
24
26 HTML::TreeBuilder::XPath is libxml based compatible interface to
27 HTML::TreeBuilder, which could be slow for a large document.
28
29 HTML::TreeBuilder::LibXML is drop-in-replacement for
30 HTML::TreeBuilder::XPath.
31
32 This module doesn't implement all of HTML::TreeBuilder and
33 HTML::Element APIs, but enough methods are defined so modules like
34 Web::Scraper work.
35
37 This is a benchmark result by tools/benchmark.pl
38
39 Web::Scraper: 0.26
40 HTML::TreeBuilder::XPath: 0.09
41 HTML::TreeBuilder::LibXML: 0.01_01
42
43 Rate no_libxml use_libxml
44 no_libxml 5.45/s -- -94%
45 use_libxml 94.3/s 1632% --
46
48 Tokuhiro Matsuno <tokuhirom@gmail.com>
49
50 Tatsuhiko Miyagawa <miyagawa@cpan.org>
51
52 Masahiro Chiba
53
55 woremacx++ http://d.hatena.ne.jp/woremacx/20080202/1201927162
56
57 id:dailyflower
58
60 HTML::TreeBuilder, HTML::TreeBuilder::XPath
61
63 This library is free software; you can redistribute it and/or modify it
64 under the same terms as Perl itself.
65
66
67
68perl v5.30.0 2019-07-26 HTML::TreeBuilder::LibXML(3pm)