1 |
wakaba |
1.2 |
<?xml version="1.0" ?> |
2 |
wakaba |
1.1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
3 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
4 |
|
|
<head> |
5 |
|
|
<title>Whatpm::ContentChecker - DOM Conformance Checker</title> |
6 |
|
|
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/pod.css" type="text/css" /> |
7 |
wakaba |
1.2 |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
8 |
|
|
<link rev="made" href="mailto:wakaba@suika.fam.cx" /> |
9 |
wakaba |
1.1 |
</head> |
10 |
|
|
|
11 |
|
|
<body> |
12 |
|
|
|
13 |
wakaba |
1.2 |
|
14 |
|
|
<!-- INDEX BEGIN --> |
15 |
|
|
<div name="index"> |
16 |
wakaba |
1.1 |
<p><a name="__index__"></a></p> |
17 |
|
|
|
18 |
|
|
<ul> |
19 |
|
|
|
20 |
|
|
<li><a href="#name">NAME</a></li> |
21 |
|
|
<li><a href="#synopsis">SYNOPSIS</a></li> |
22 |
|
|
<li><a href="#description">DESCRIPTION</a></li> |
23 |
|
|
<li><a href="#methods">METHODS</a></li> |
24 |
|
|
<li><a href="#bugs">BUGS</a></li> |
25 |
wakaba |
1.2 |
<li><a href="#notes_on_implementation_details">NOTES ON IMPLEMENTATION DETAILS</a></li> |
26 |
|
|
<ul> |
27 |
|
|
|
28 |
|
|
<li><a href="#the__self___flag__structure">The <code>$self->{flag}</code> Structure</a></li> |
29 |
|
|
<li><a href="#the__element_state_structure">The <code>$element_state</code> Structure</a></li> |
30 |
|
|
</ul> |
31 |
|
|
|
32 |
wakaba |
1.1 |
<li><a href="#see_also">SEE ALSO</a></li> |
33 |
|
|
<li><a href="#author">AUTHOR</a></li> |
34 |
|
|
<li><a href="#license">LICENSE</a></li> |
35 |
|
|
</ul> |
36 |
wakaba |
1.2 |
|
37 |
|
|
<hr name="index" /> |
38 |
|
|
</div> |
39 |
wakaba |
1.1 |
<!-- INDEX END --> |
40 |
|
|
|
41 |
|
|
<p> |
42 |
|
|
</p> |
43 |
|
|
<h1><a name="name">NAME</a></h1> |
44 |
|
|
<p>Whatpm::ContentChecker - DOM Conformance Checker</p> |
45 |
|
|
<p> |
46 |
|
|
</p> |
47 |
|
|
<hr /> |
48 |
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1> |
49 |
|
|
<pre> |
50 |
|
|
use Whatpm::ContentChecker; |
51 |
|
|
|
52 |
|
|
Whatpm::ContentChecker->check_document ($doc, sub { |
53 |
|
|
my %arg = @_; |
54 |
|
|
warn get_node_path ($arg{node}), ": ", |
55 |
|
|
($arg{level} || "Error"), ": ", |
56 |
|
|
$arg{type}, "\n"; |
57 |
|
|
}); |
58 |
|
|
|
59 |
|
|
Whatpm::ContentChecker->check_element ($doc, sub { |
60 |
|
|
my %arg = @_; |
61 |
|
|
warn get_node_path ($arg{node}), ": ", |
62 |
|
|
($arg{level} || "Error"), ": ", |
63 |
|
|
$arg{type}, "\n"; |
64 |
|
|
});</pre> |
65 |
|
|
<p> |
66 |
|
|
</p> |
67 |
|
|
<hr /> |
68 |
|
|
<h1><a name="description">DESCRIPTION</a></h1> |
69 |
|
|
<p>The <code>Whatpm::ContentChecker</code> Perl module contains two methods |
70 |
|
|
to validate DOM tree for its conformance to the markup language |
71 |
|
|
in use.</p> |
72 |
|
|
<p>This module is part of Whatpm, Perl Modules for |
73 |
|
|
Web Hypertext Application Technologies, which is a subproject |
74 |
|
|
of manakai.</p> |
75 |
|
|
<p> |
76 |
|
|
</p> |
77 |
|
|
<hr /> |
78 |
|
|
<h1><a name="methods">METHODS</a></h1> |
79 |
|
|
<p>This module contains two static methods:</p> |
80 |
|
|
<dl> |
81 |
wakaba |
1.2 |
<dt><strong><a name="check_document" class="item">Whatpm::ContentChecker->check_document (<em>$document</em>, <em>$onerror</em>);</a></strong> |
82 |
|
|
|
83 |
wakaba |
1.1 |
<dd> |
84 |
wakaba |
1.2 |
<p>Checks a document, <em>$document</em>, and its descendant for their |
85 |
wakaba |
1.1 |
conformance. If there is an error or a warnign, then the |
86 |
|
|
<em>$onerror</em> <code>CODE</code> is invoked with named arguments same |
87 |
wakaba |
1.2 |
as ones for the method <a href="#check_element"><code>check_element</code></a>.</p> |
88 |
wakaba |
1.1 |
</dd> |
89 |
wakaba |
1.2 |
</li> |
90 |
|
|
<dt><strong><a name="check_element" class="item">Whatpm::ContentChecker->check_element (<em>$element</em>, <em>$onerror</em>);</a></strong> |
91 |
|
|
|
92 |
wakaba |
1.1 |
<dd> |
93 |
wakaba |
1.2 |
<p>Checks an element, <em>$element</em>, and its descendant for their conformance. |
94 |
wakaba |
1.1 |
If there is an error or a warning, then the <em>$onerror</em> <code>CODE</code> |
95 |
wakaba |
1.2 |
is invoked with named arguments:</p> |
96 |
wakaba |
1.1 |
</dd> |
97 |
|
|
<dl> |
98 |
wakaba |
1.2 |
<dt><strong><a name="level" class="item">level (Might be <code>undef</code>)</a></strong> |
99 |
|
|
|
100 |
wakaba |
1.1 |
<dd> |
101 |
wakaba |
1.2 |
<p>A string which describes the severity of the error or warning. |
102 |
wakaba |
1.1 |
For the list of the severities, see |
103 |
wakaba |
1.2 |
<http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>.</p> |
104 |
wakaba |
1.1 |
</dd> |
105 |
wakaba |
1.2 |
</li> |
106 |
|
|
<dt><strong><a name="node" class="item">node (Always specified)</a></strong> |
107 |
|
|
|
108 |
wakaba |
1.1 |
<dd> |
109 |
wakaba |
1.2 |
<p>The node with which the error is detected.</p> |
110 |
wakaba |
1.1 |
</dd> |
111 |
wakaba |
1.2 |
</li> |
112 |
|
|
<dt><strong><a name="type" class="item">type (Always specified)</a></strong> |
113 |
|
|
|
114 |
wakaba |
1.1 |
<dd> |
115 |
wakaba |
1.2 |
<p>A string which describes the type of the error or warning. |
116 |
wakaba |
1.1 |
For the list of the errors and warnings, see |
117 |
wakaba |
1.2 |
<http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types>.</p> |
118 |
wakaba |
1.1 |
</dd> |
119 |
wakaba |
1.2 |
</li> |
120 |
|
|
</dl> |
121 |
wakaba |
1.1 |
</dl> |
122 |
|
|
<p> |
123 |
|
|
</p> |
124 |
|
|
<hr /> |
125 |
|
|
<h1><a name="bugs">BUGS</a></h1> |
126 |
|
|
<p>This conformance checker is work in progress; it <em>might</em> not be |
127 |
|
|
able to detect all the errors in the DOM tree, and it <em>might</em> |
128 |
|
|
detect an error for a node that is conforming in fact.</p> |
129 |
|
|
<p> |
130 |
|
|
</p> |
131 |
|
|
<hr /> |
132 |
wakaba |
1.2 |
<h1><a name="notes_on_implementation_details">NOTES ON IMPLEMENTATION DETAILS</a></h1> |
133 |
|
|
<p><em>This section is not complete.</em></p> |
134 |
|
|
<p>This section describes various internal constructions used in |
135 |
|
|
<a href="../Whatpm/ContentChecker.html">the Whatpm::ContentChecker manpage</a> and relevant modules. These data structures |
136 |
|
|
are not public interfaces -- they should not be accessed or modified |
137 |
|
|
by applications. They are documented here for the convenience of |
138 |
|
|
development only.</p> |
139 |
|
|
<p> |
140 |
|
|
</p> |
141 |
|
|
<h2><a name="the__self___flag__structure">The <code>$self->{flag}</code> Structure</a></h2> |
142 |
|
|
<dl> |
143 |
|
|
<dt><strong><a name="_self___flag____has_label_" class="item"><code>$self->{flag}->{has_label}</code></a></strong> |
144 |
|
|
|
145 |
|
|
<dd> |
146 |
|
|
<p>This flag is set to a true value if and only if there is a <code>label</code> |
147 |
|
|
element ancestor of the current node.</p> |
148 |
|
|
</dd> |
149 |
|
|
</li> |
150 |
|
|
<dt><strong><a name="_self___flag____has_labelable_" class="item"><code>$self->{flag}->{has_labelable}</code></a></strong> |
151 |
|
|
|
152 |
|
|
<dd> |
153 |
|
|
<p>This flag is set to <code>1</code> if and only if a nearest ancestor <code>label</code> |
154 |
|
|
element has the <code>for</code> attribute and there is no labelable |
155 |
|
|
form-associated element that is a descendant of the <code>label</code> element |
156 |
|
|
and precedes the current node in tree order. This flag is set to <code>2</code> |
157 |
|
|
if and only if there is a labelable form-associated element that is a |
158 |
|
|
descendant of the nearest ancestor <code>label</code> element of the current |
159 |
|
|
node and precedes the current node in tree order. This flag is |
160 |
|
|
otherwise set to a false value. <strong>However</strong>, when there is no ancestor |
161 |
|
|
<code>label</code> element of the current node, i.e. when |
162 |
|
|
<a href="#_self___flag____has_label_"><code>$self->{flag}->{has_label}</code></a> is false, the value of the |
163 |
|
|
<a href="#_self___flag____has_labelable_"><code>$self->{flag}->{has_labelable}</code></a> flag is <em>undefined</em>.</p> |
164 |
|
|
</dd> |
165 |
|
|
</li> |
166 |
|
|
</dl> |
167 |
|
|
<p> |
168 |
|
|
</p> |
169 |
|
|
<h2><a name="the__element_state_structure">The <code>$element_state</code> Structure</a></h2> |
170 |
|
|
<dl> |
171 |
|
|
<dt><strong><a name="_element_state___has_label_original_" class="item"><code>$element_state->{has_label_original}</code></a></strong> |
172 |
|
|
|
173 |
|
|
<dd> |
174 |
|
|
<p>Used to preserve the value of <a href="#_self___flag____has_label_"><code>$self->{flag}->{has_label}</code></a> at the |
175 |
|
|
time of invocation of the method <code>element_start</code> for the element |
176 |
|
|
being checked.</p> |
177 |
|
|
</dd> |
178 |
|
|
</li> |
179 |
|
|
<dt><strong><a name="_element_state___has_labelable_original_" class="item"><code>$element_state->{has_labelable_original}</code></a></strong> |
180 |
|
|
|
181 |
|
|
<dd> |
182 |
|
|
<p>Used to preserve the value of <a href="#_self___flag____has_labelable_"><code>$self->{flag}->{has_labelable}</code></a> at |
183 |
|
|
the time of invocation of the method <code>element_start</code> for the element |
184 |
|
|
being checked.</p> |
185 |
|
|
</dd> |
186 |
|
|
</li> |
187 |
|
|
</dl> |
188 |
|
|
<p> |
189 |
|
|
</p> |
190 |
|
|
<hr /> |
191 |
wakaba |
1.1 |
<h1><a name="see_also">SEE ALSO</a></h1> |
192 |
|
|
<p><a href="../Whatpm/ContentChecker/Atom.html">the Whatpm::ContentChecker::Atom manpage</a></p> |
193 |
|
|
<p><a href="../Whatpm/ContentChecker/HTML.html">the Whatpm::ContentChecker::HTML manpage</a></p> |
194 |
|
|
<p><http://suika.fam.cx/gate/2005/sw/Whatpm%20Error%20Types></p> |
195 |
|
|
<p> |
196 |
|
|
</p> |
197 |
|
|
<hr /> |
198 |
|
|
<h1><a name="author">AUTHOR</a></h1> |
199 |
|
|
<p>Wakaba <<a href="mailto:w@suika.fam.cx">w@suika.fam.cx</a>></p> |
200 |
|
|
<p> |
201 |
|
|
</p> |
202 |
|
|
<hr /> |
203 |
|
|
<h1><a name="license">LICENSE</a></h1> |
204 |
wakaba |
1.2 |
<p>Copyright 2007-2008 Wakaba <<a href="mailto:w@suika.fam.cx">w@suika.fam.cx</a>></p> |
205 |
wakaba |
1.1 |
<p>This library is free software; you can redistribute it |
206 |
|
|
and/or modify it under the same terms as Perl itself.</p> |
207 |
|
|
|
208 |
|
|
</body> |
209 |
|
|
|
210 |
|
|
</html> |