NAME

Whatpm::ContentChecker - DOM Conformance Checker


SYNOPSIS

  use Whatpm::ContentChecker;
  
  Whatpm::ContentChecker->check_document ($doc, sub {
    my %arg = @_;
    warn get_node_path ($arg{node}), ": ",
        ($arg{level} || "Error"), ": ",
        $arg{type}, "\n";
  });
  
  Whatpm::ContentChecker->check_element ($doc, sub {
    my %arg = @_;
    warn get_node_path ($arg{node}), ": ",
        ($arg{level} || "Error"), ": ",
        $arg{type}, "\n";
  });


DESCRIPTION

The Whatpm::ContentChecker Perl module contains two methods to validate DOM tree for its conformance to the markup language in use.

This module is part of Whatpm, Perl Modules for Web Hypertext Application Technologies, which is a subproject of manakai.


METHODS

This module contains two static methods:

Whatpm::ContentChecker->check_document ($document, $onerror);
Checks a document, $document, and its descendant for their conformance. If there is an error or a warnign, then the $onerror CODE is invoked with named arguments same as ones for the method check_element.

Whatpm::ContentChecker->check_element ($element, $onerror);
Checks an element, $element, and its descendant for their conformance. If there is an error or a warning, then the $onerror CODE is invoked with named arguments:
level (Might be undef)
A string which describes the severity of the error or warning. For the list of the severities, see <http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>.

node (Always specified)
The node with which the error is detected.

type (Always specified)
A string which describes the type of the error or warning. For the list of the errors and warnings, see <http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>.


BUGS

This conformance checker is work in progress; it might not be able to detect all the errors in the DOM tree, and it might detect an error for a node that is conforming in fact.


SEE ALSO

the Whatpm::ContentChecker::Atom manpage

the Whatpm::ContentChecker::HTML manpage

<http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>


AUTHOR

Wakaba <w@suika.fam.cx>


LICENSE

Copyright 2007 Wakaba <w@suika.fam.cx>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.