rest25/library/htmllib.rst => rest262/library/htmllib.rst
n1- 
2:mod:`htmllib` --- A parser for HTML documents
3==============================================
4
5.. module:: htmllib
6   :synopsis: A parser for HTML documents.
n6+   :deprecated:
7+ 
8+.. deprecated:: 2.6
9+    The :mod:`htmllib` module has been removed in Python 3.0.
7
8
9.. index::
10   single: HTML
11   single: hypertext
12
13.. index::
14   module: sgmllib
54  :meth:`do_tag` method.
55
56The module defines a parser class and an exception:
57
58
59.. class:: HTMLParser(formatter)
60
61   This is the basic HTML parser class.  It supports all entity names required by
n62-   the XHTML 1.0 Recommendation (`<http://www.w3.org/TR/xhtml1>`_).   It also
n65+   the XHTML 1.0 Recommendation (http://www.w3.org/TR/xhtml1).   It also defines
63-   defines handlers for all HTML 2.0 and many HTML 3.0 and 3.2 elements.
66+   handlers for all HTML 2.0 and many HTML 3.0 and 3.2 elements.
64
65
66.. exception:: HTMLParseError
67
68   Exception raised by the :class:`HTMLParser` class when it encounters an error
69   while parsing.
70
71   .. versionadded:: 2.4
93
94HTMLParser Objects
95------------------
96
97In addition to tag methods, the :class:`HTMLParser` class provides some
98additional methods and instance variables for use within tag methods.
99
100
n101-.. attribute:: XXX Class.formatter
n104+.. attribute:: HTMLParser.formatter
102
103   This is the formatter instance associated with the parser.
104
105
n106-.. attribute:: XXX Class.nofill
n109+.. attribute:: HTMLParser.nofill
107
108   Boolean flag which should be true when whitespace should not be collapsed, or
109   false when it should be.  In general, this should only be true when character
110   data is to be treated as "preformatted" text, as within a ``<PRE>`` element.
111   The default value is false.  This affects the operation of :meth:`handle_data`
112   and :meth:`save_end`.
113
114
n115-.. method:: XXX Class.anchor_bgn(href, name, type)
n118+.. method:: HTMLParser.anchor_bgn(href, name, type)
116
117   This method is called at the start of an anchor region.  The arguments
118   correspond to the attributes of the ``<A>`` tag with the same names.  The
119   default implementation maintains a list of hyperlinks (defined by the ``HREF``
120   attribute for ``<A>`` tags) within the document.  The list of hyperlinks is
121   available as the data attribute :attr:`anchorlist`.
122
123
n124-.. method:: XXX Class.anchor_end()
n127+.. method:: HTMLParser.anchor_end()
125
126   This method is called at the end of an anchor region.  The default
127   implementation adds a textual footnote marker using an index into the list of
128   hyperlinks created by :meth:`anchor_bgn`.
129
130
n131-.. method:: XXX Class.handle_image(source, alt[, ismap[, align[, width[, height]]]])
n134+.. method:: HTMLParser.handle_image(source, alt[, ismap[, align[, width[, height]]]])
132
133   This method is called to handle images.  The default implementation simply
134   passes the *alt* value to the :meth:`handle_data` method.
135
136
n137-.. method:: XXX Class.save_bgn()
n140+.. method:: HTMLParser.save_bgn()
138
139   Begins saving character data in a buffer instead of sending it to the formatter
140   object.  Retrieve the stored data via :meth:`save_end`. Use of the
141   :meth:`save_bgn` / :meth:`save_end` pair may not be nested.
142
143
n144-.. method:: XXX Class.save_end()
n147+.. method:: HTMLParser.save_end()
145
146   Ends buffering character data and returns all data saved since the preceding
147   call to :meth:`save_bgn`.  If the :attr:`nofill` flag is false, whitespace is
148   collapsed to single spaces.  A call to this method without a preceding call to
149   :meth:`save_bgn` will raise a :exc:`TypeError` exception.
150
151
152:mod:`htmlentitydefs` --- Definitions of HTML general entities
153==============================================================
154
155.. module:: htmlentitydefs
156   :synopsis: Definitions of HTML general entities.
157.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
t161+ 
162+.. note::
163+ 
164+   The :mod:`htmlentitydefs` module has been renamed to :mod:`html.entities` in
165+   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
166+   converting your sources to 3.0.
158
159
160This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``,
161and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to
162provide the :attr:`entitydefs` member of the :class:`HTMLParser` class.  The
163definition provided here contains all the entities defined by XHTML 1.0  that
164can be handled using simple textual substitution in the Latin-1 character set
165(ISO-8859-1).
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op