1HTML::Tree(3) User Contributed Perl Documentation HTML::Tree(3)
2
3
4
6 HTML::Tree - build and scan parse-trees of HTML
7
9 This document describes version 5.07 of HTML::Tree, released August 31,
10 2017 as part of HTML-Tree.
11
13 use HTML::TreeBuilder;
14 my $tree = HTML::TreeBuilder->new();
15 $tree->parse_file($filename);
16
17 # Then do something with the tree, using HTML::Element
18 # methods -- for example:
19
20 $tree->dump
21
22 # Finally:
23
24 $tree->delete;
25
27 HTML-Tree is a suite of Perl modules for making parse trees out of HTML
28 source. It consists of mainly two modules, whose documentation you
29 should refer to: HTML::TreeBuilder and HTML::Element.
30
31 HTML::TreeBuilder is the module that builds the parse trees. (It uses
32 HTML::Parser to do the work of breaking the HTML up into tokens.)
33
34 The tree that TreeBuilder builds for you is made up of objects of the
35 class HTML::Element.
36
37 If you find that you do not properly understand the documentation for
38 HTML::TreeBuilder and HTML::Element, it may be because you are
39 unfamiliar with tree-shaped data structures, or with object-oriented
40 modules in general. Sean Burke has written some articles for The Perl
41 Journal ("www.tpj.com") that seek to provide that background. The full
42 text of those articles is contained in this distribution, as:
43
44 HTML::Tree::AboutObjects
45 "User's View of Object-Oriented Modules" from TPJ17.
46
47 HTML::Tree::AboutTrees
48 "Trees" from TPJ18
49
50 HTML::Tree::Scanning
51 "Scanning HTML" from TPJ19
52
53 Readers already familiar with object-oriented modules and tree-shaped
54 data structures should read just the last article. Readers without
55 that background should read the first, then the second, and then the
56 third.
57
59 All these methods simply redirect to the corresponding method in
60 HTML::TreeBuilder. It's more efficient to use HTML::TreeBuilder
61 directly, and skip loading HTML::Tree at all.
62
63 new
64 Redirects to "new" in HTML::TreeBuilder.
65
66 new_from_file
67 Redirects to "new_from_file" in HTML::TreeBuilder.
68
69 new_from_content
70 Redirects to "new_from_content" in HTML::TreeBuilder.
71
72 new_from_url
73 Redirects to "new_from_url" in HTML::TreeBuilder.
74
76 You can find documentation for this module with the perldoc command.
77
78 perldoc HTML::Tree
79
80 You can also look for information at:
81
82 · AnnoCPAN: Annotated CPAN documentation
83
84 <http://annocpan.org/dist/HTML-Tree>
85
86 · CPAN Ratings
87
88 <http://cpanratings.perl.org/d/HTML-Tree>
89
90 · RT: CPAN's request tracker
91
92 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Tree>
93
94 · Search CPAN
95
96 <http://search.cpan.org/dist/HTML-Tree>
97
98 · Stack Overflow
99
100 <http://stackoverflow.com/questions/tagged/html-tree>
101
102 If you have a question about how to use HTML-Tree, Stack Overflow
103 is the place to ask it. Make sure you tag it both "perl" and
104 "html-tree".
105
107 HTML::TreeBuilder, HTML::Element, HTML::Tagset, HTML::Parser,
108 HTML::DOMbo
109
110 The book Perl & LWP by Sean M. Burke published by O'Reilly and
111 Associates, 2002. ISBN: 0-596-00178-9
112
113 It has several chapters to do with HTML processing in general, and
114 HTML-Tree specifically. There's more info at:
115
116 http://www.oreilly.com/catalog/perllwp/
117
118 http://www.amazon.com/exec/obidos/ASIN/0596001789
119
121 HTML-Tree is now maintained using Git. The main public repository is
122 <https://github.com/kentfredric/HTML-Tree>.
123
124 The best way to send a patch is to make a pull request there.
125
127 Thanks to Gisle Aas, Sean Burke and Andy Lester for their original
128 work.
129
130 Thanks to Chicago Perl Mongers (http://chicago.pm.org) for their
131 patches submitted to HTML::Tree as part of the Phalanx project
132 (http://qa.perl.org/phalanx).
133
134 Thanks to the following people for additional patches and
135 documentation: Terrence Brannon, Gordon Lack, Chris Madsen and Ricardo
136 Signes.
137
139 Current maintainers:
140
141 · Christopher J. Madsen "<perl AT cjmweb.net>"
142
143 · Jeff Fearn "<jfearn AT cpan.org>"
144
145 Original HTML-Tree author:
146
147 · Gisle Aas
148
149 Former maintainers:
150
151 · Sean M. Burke
152
153 · Andy Lester
154
155 · Pete Krawczyk "<petek AT cpan.org>"
156
157 You can follow or contribute to HTML-Tree's development at
158 <https://github.com/kentfredric/HTML-Tree>.
159
161 Copyright 1995-1998 Gisle Aas, 1999-2004 Sean M. Burke, 2005 Andy
162 Lester, 2006 Pete Krawczyk, 2010 Jeff Fearn, 2012 Christopher J.
163 Madsen. (Except the articles contained in HTML::Tree::AboutObjects,
164 HTML::Tree::AboutTrees, and HTML::Tree::Scanning, which are all
165 copyright 2000 The Perl Journal.)
166
167 Except for those three TPJ articles, the whole HTML-Tree distribution,
168 of which this file is a part, is free software; you can redistribute it
169 and/or modify it under the same terms as Perl itself.
170
171 Those three TPJ articles may be distributed under the same terms as
172 Perl itself.
173
174 The programs in this library are distributed in the hope that they will
175 be useful, but without any warranty; without even the implied warranty
176 of merchantability or fitness for a particular purpose.
177
178
179
180perl v5.28.0 2018-07-14 HTML::Tree(3)