1Tagset(3)             User Contributed Perl Documentation            Tagset(3)
2
3
4

NAME

6       HTML::Tagset - data tables useful in parsing HTML
7

VERSION

9       Version 3.20
10

SYNOPSIS

12         use HTML::Tagset;
13         # Then use any of the items in the HTML::Tagset package
14         #  as need arises
15

DESCRIPTION

17       This module contains several data tables useful in various kinds of
18       HTML parsing operations.
19
20       Note that all tag names used are lowercase.
21
22       In the following documentation, a "hashset" is a hash being used as a
23       set -- the hash conveys that its keys are there, and the actual values
24       associated with the keys are not significant.  (But what values are
25       there, are always true.)
26

VARIABLES

28       Note that none of these variables are exported.
29
30   hashset %HTML::Tagset::emptyElement
31       This hashset has as values the tag-names (GIs) of elements that cannot
32       have content.  (For example, "base", "br", "hr".)  So
33       $HTML::Tagset::emptyElement{'hr'} exists and is true.
34       $HTML::Tagset::emptyElement{'dl'} does not exist, and so is not true.
35
36   hashset %HTML::Tagset::optionalEndTag
37       This hashset lists tag-names for elements that can have content, but
38       whose end-tags are generally, "safely", omissible.  Example:
39       $HTML::Tagset::emptyElement{'li'} exists and is true.
40
41   hash %HTML::Tagset::linkElements
42       Values in this hash are tagnames for elements that might contain links,
43       and the value for each is a reference to an array of the names of
44       attributes whose values can be links.
45
46   hash %HTML::Tagset::boolean_attr
47       This hash (not hashset) lists what attributes of what elements can be
48       printed without showing the value (for example, the "noshade" attribute
49       of "hr" elements).  For elements with only one such attribute, its
50       value is simply that attribute name.  For elements with many such
51       attributes, the value is a reference to a hashset containing all such
52       attributes.
53
54   hashset %HTML::Tagset::isPhraseMarkup
55       This hashset contains all phrasal-level elements.
56
57   hashset %HTML::Tagset::is_Possible_Strict_P_Content
58       This hashset contains all phrasal-level elements that be content of a P
59       element, for a strict model of HTML.
60
61   hashset %HTML::Tagset::isHeadElement
62       This hashset contains all elements that elements that should be present
63       only in the 'head' element of an HTML document.
64
65   hashset %HTML::Tagset::isList
66       This hashset contains all elements that can contain "li" elements.
67
68   hashset %HTML::Tagset::isTableElement
69       This hashset contains all elements that are to be found only in/under a
70       "table" element.
71
72   hashset %HTML::Tagset::isFormElement
73       This hashset contains all elements that are to be found only in/under a
74       "form" element.
75
76   hashset %HTML::Tagset::isBodyMarkup
77       This hashset contains all elements that are to be found only in/under
78       the "body" element of an HTML document.
79
80   hashset %HTML::Tagset::isHeadOrBodyElement
81       This hashset includes all elements that I notice can fall either in the
82       head or in the body.
83
84   hashset %HTML::Tagset::isKnown
85       This hashset lists all known HTML elements.
86
87   hashset %HTML::Tagset::canTighten
88       This hashset lists elements that might have ignorable whitespace as
89       children or siblings.
90
91   array @HTML::Tagset::p_closure_barriers
92       This array has a meaning that I have only seen a need for in
93       "HTML::TreeBuilder", but I include it here on the off chance that
94       someone might find it of use:
95
96       When we see a "<p>" token, we go lookup up the lineage for a p element
97       we might have to minimize.  At first sight, we might say that if
98       there's a p anywhere in the lineage of this new p, it should be closed.
99       But that's wrong.  Consider this document:
100
101         <html>
102           <head>
103             <title>foo</title>
104           </head>
105           <body>
106             <p>foo
107               <table>
108                 <tr>
109                   <td>
110                      foo
111                      <p>bar
112                   </td>
113                 </tr>
114               </table>
115             </p>
116           </body>
117         </html>
118
119       The second p is quite legally inside a much higher p.
120
121       My formalization of the reason why this is legal, but this:
122
123         <p>foo<p>bar</p></p>
124
125       isn't, is that something about the table constitutes a "barrier" to the
126       application of the rule about what p must minimize.
127
128       So @HTML::Tagset::p_closure_barriers is the list of all such barrier-
129       tags.
130
131   hashset %isCDATA_Parent
132       This hashset includes all elements whose content is CDATA.
133

CAVEATS

135       You may find it useful to alter the behavior of modules (like
136       "HTML::Element" or "HTML::TreeBuilder") that use "HTML::Tagset"'s data
137       tables by altering the data tables themselves.  You are welcome to try,
138       but be careful; and be aware that different modules may or may react
139       differently to the data tables being changed.
140
141       Note that it may be inappropriate to use these tables for producing
142       HTML -- for example, %isHeadOrBodyElement lists the tagnames for all
143       elements that can appear either in the head or in the body, such as
144       "script".  That doesn't mean that I am saying your code that produces
145       HTML should feel free to put script elements in either place!  If you
146       are producing programs that spit out HTML, you should be intimately
147       familiar with the DTDs for HTML or XHTML (available at
148       "http://www.w3.org/"), and you should slavishly obey them, not the data
149       tables in this document.
150

SEE ALSO

152       HTML::Element, HTML::TreeBuilder, HTML::LinkExtor
153
155       Copyright 1995-2000 Gisle Aas.
156
157       Copyright 2000-2005 Sean M. Burke.
158
159       Copyright 2005-2008 Andy Lester.
160
161       This program is free software; you can redistribute it and/or modify it
162       under the same terms as Perl itself.
163

ACKNOWLEDGEMENTS

165       Most of the code/data in this module was adapted from code written by
166       Gisle Aas for "HTML::Element", "HTML::TreeBuilder", and
167       "HTML::LinkExtor".  Then it was maintained by Sean M. Burke.
168

AUTHOR

170       Current maintainer: Andy Lester, "<andy at petdance.com>"
171

BUGS

173       Please report any bugs or feature requests to "bug-html-tagset at
174       rt.cpan.org", or through the web interface at
175       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Tagset>.  I will
176       be notified, and then you'll automatically be notified of progress on
177       your bug as I make changes.
178
179
180
181perl v5.30.1                      2020-01-30                         Tagset(3)
Impressum