HTML::DOM is a Perl module that implements the HTML Document Object Model by extending the HTML::Tree modules. The HTML::DOM class serves both as an HTML parser and as the document class.
The following DOM modules are currently supported:
Feature Version (aka level)
------- -------------------
HTML 2.0
Core 2.0
Events 2.0
UIEvents 2.0
MouseEvents 2.0
MutationEvents 2.0
HTMLEvents 2.0
StyleSheets 2.0
CSS 2.0 (partially)
CSS2 2.0
Views 2.0
StyleSheets, CSS and CSS2 are actually provided by CSS::DOM. This list corresponds to CSS::DOM versions 0.02 to 0.14.
SYNOPSIS
use HTML::DOM;
my $dom_tree = new HTML::DOM; # empty tree
$dom_tree->write($source_code);
$dom_tree->close;
my $other_dom_tree = new HTML::DOM;
$other_dom_tree->parse_file($filename);
$dom_tree->getElementsByTagName('body')->[0]->appendChild(
$dom_tree->createElement('input')
);
print $dom_tree->innerHTML, "\n";
my $text = $dom_tree->createTextNode('text');
$text->data; # get attribute
$text->data('new value'); # set attribute
Product's homepage
Requirements:
· Perl