HTML::TreeBuilder

HTML::TreeBuilder is a parser that builds a HTML syntax tree.
Download

HTML::TreeBuilder Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Pete Krawczyk
  • Publisher web site:
  • http://search.cpan.org/~petek/HTML-Tree-3.23/lib/HTML/Element.pm

HTML::TreeBuilder Tags


HTML::TreeBuilder Description

HTML::TreeBuilder is a parser that builds a HTML syntax tree. HTML::TreeBuilder is a parser that builds a HTML syntax tree.SYNOPSIS foreach my $file_name (@ARGV) { my $tree = HTML::TreeBuilder->new; # empty tree $tree->parse_file($file_name); print "Hey, here's a dump of the parse tree of $file_name:n"; $tree->dump; # a method we inherit from HTML::Element print "And here it is, bizarrely rerendered as HTML:n", $tree->as_HTML, "n"; # Now that we're done with it, we must destroy it. $tree = $tree->delete; }(This class is part of the HTML::Tree dist.)This class is for HTML syntax trees that get built out of HTML source. The way to use it is to:1. start a new (empty) HTML::TreeBuilder object,2. then use one of the methods from HTML::Parser (presumably with $tree->parse_file($filename) for files, or with $tree->parse($document_content) and $tree->eof if you've got the content in a string) to parse the HTML document into the tree $tree.(You can combine steps 1 and 2 with the "new_from_file" or "new_from_content" methods.)2b. call $root->elementify() if you want.3. do whatever you need to do with the syntax tree, presumably involving traversing it looking for some bit of information in it,4. and finally, when you're done with the tree, call $tree->delete() to erase the contents of the tree from memory. This kind of thing usually isn't necessary with most Perl objects, but it's necessary for TreeBuilder objects. See HTML::Element for a more verbose explanation of why this is the case. Requirements: · Perl


HTML::TreeBuilder Related Software