1 |
wakaba |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
|
|
Whatpm::ContentChecker - DOM Conformance Checker |
4 |
|
|
|
5 |
|
|
=head1 SYNOPSIS |
6 |
|
|
|
7 |
|
|
use Whatpm::ContentChecker; |
8 |
|
|
|
9 |
|
|
Whatpm::ContentChecker->check_document ($doc, sub { |
10 |
|
|
my %arg = @_; |
11 |
|
|
warn get_node_path ($arg{node}), ": ", |
12 |
|
|
($arg{level} || "Error"), ": ", |
13 |
|
|
$arg{type}, "\n"; |
14 |
|
|
}); |
15 |
|
|
|
16 |
|
|
Whatpm::ContentChecker->check_element ($doc, sub { |
17 |
|
|
my %arg = @_; |
18 |
|
|
warn get_node_path ($arg{node}), ": ", |
19 |
|
|
($arg{level} || "Error"), ": ", |
20 |
|
|
$arg{type}, "\n"; |
21 |
|
|
}); |
22 |
|
|
|
23 |
|
|
=head1 DESCRIPTION |
24 |
|
|
|
25 |
|
|
The C<Whatpm::ContentChecker> Perl module contains two methods |
26 |
|
|
to validate DOM tree for its conformance to the markup language |
27 |
|
|
in use. |
28 |
|
|
|
29 |
|
|
This module is part of Whatpm, Perl Modules for |
30 |
|
|
Web Hypertext Application Technologies, which is a subproject |
31 |
|
|
of manakai. |
32 |
|
|
|
33 |
|
|
=head1 METHODS |
34 |
|
|
|
35 |
|
|
This module contains two static methods: |
36 |
|
|
|
37 |
|
|
=over 4 |
38 |
|
|
|
39 |
|
|
=item Whatpm::ContentChecker->check_document (I<$document>, I<$onerror>); |
40 |
|
|
|
41 |
|
|
Checks a document, I<$document>, and its descendant for their |
42 |
|
|
conformance. If there is an error or a warnign, then the |
43 |
|
|
I<$onerror> C<CODE> is invoked with named arguments same |
44 |
|
|
as ones for the method C<check_element>. |
45 |
|
|
|
46 |
|
|
=item Whatpm::ContentChecker->check_element (I<$element>, I<$onerror>); |
47 |
|
|
|
48 |
|
|
Checks an element, I<$element>, and its descendant for their conformance. |
49 |
|
|
If there is an error or a warning, then the I<$onerror> C<CODE> |
50 |
|
|
is invoked with named arguments: |
51 |
|
|
|
52 |
|
|
=over 4 |
53 |
|
|
|
54 |
|
|
=item level (Might be C<undef>) |
55 |
|
|
|
56 |
|
|
A string which describes the severity of the error or warning. |
57 |
|
|
For the list of the severities, see |
58 |
|
|
<http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>. |
59 |
|
|
|
60 |
|
|
=item node (Always specified) |
61 |
|
|
|
62 |
|
|
The node with which the error is detected. |
63 |
|
|
|
64 |
|
|
=item type (Always specified) |
65 |
|
|
|
66 |
|
|
A string which describes the type of the error or warning. |
67 |
|
|
For the list of the errors and warnings, see |
68 |
|
|
<http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>. |
69 |
|
|
|
70 |
|
|
=back |
71 |
|
|
|
72 |
|
|
=back |
73 |
|
|
|
74 |
|
|
=head1 BUGS |
75 |
|
|
|
76 |
|
|
This conformance checker is work in progress; it I<might> not be |
77 |
|
|
able to detect all the errors in the DOM tree, and it I<might> |
78 |
|
|
detect an error for a node that is conforming in fact. |
79 |
|
|
|
80 |
|
|
=head1 SEE ALSO |
81 |
|
|
|
82 |
|
|
L<Whatpm::ContentChecker::Atom> |
83 |
|
|
|
84 |
|
|
L<Whatpm::ContentChecker::HTML> |
85 |
|
|
|
86 |
|
|
<http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types> |
87 |
|
|
|
88 |
|
|
=head1 AUTHOR |
89 |
|
|
|
90 |
|
|
Wakaba <w@suika.fam.cx> |
91 |
|
|
|
92 |
|
|
=head1 LICENSE |
93 |
|
|
|
94 |
|
|
Copyright 2007 Wakaba <w@suika.fam.cx> |
95 |
|
|
|
96 |
|
|
This library is free software; you can redistribute it |
97 |
|
|
and/or modify it under the same terms as Perl itself. |
98 |
|
|
|
99 |
|
|
=cut |
100 |
|
|
|
101 |
|
|
# $Date: 2007/05/02 13:44:34 $ |