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