rest25/library/sgmllib.rst => rest262/library/sgmllib.rst
n1- 
2:mod:`sgmllib` --- Simple SGML parser
3=====================================
4
5.. module:: sgmllib
6   :synopsis: Only as much of an SGML parser as needed to parse HTML.
n6+   :deprecated:
7
n8+.. deprecated:: 2.6
9+    The :mod:`sgmllib` module has been removed in Python 3.0.
8
9.. index:: single: SGML
10
11This module defines a class :class:`SGMLParser` which serves as the basis for
12parsing text files formatted in SGML (Standard Generalized Mark-up Language).
13In fact, it does not provide a full SGML parser --- it only parses SGML insofar
14as it is used by HTML, and the module only exists as a base for the
15:mod:`htmllib` module.  Another HTML parser which supports XHTML and offers a
16somewhat different interface is available in the :mod:`HTMLParser` module.
17
18
19.. class:: SGMLParser()
20
21   The :class:`SGMLParser` class is instantiated without arguments. The parser is
22   hardcoded to recognize the following constructs:
23
n24-* Opening and closing tags of the form ``<tag attr="value" ...>`` and
n26+   * Opening and closing tags of the form ``<tag attr="value" ...>`` and
25     ``</tag>``, respectively.
26
n27-* Numeric character references of the form ``&#name;``.
n29+   * Numeric character references of the form ``&#name;``.
28
n29-* Entity references of the form ``&name;``.
n31+   * Entity references of the form ``&name;``.
30
n31-* SGML comments of the form ``<!--text-->``.  Note that spaces, tabs, and
n33+   * SGML comments of the form ``<!--text-->``.  Note that spaces, tabs, and
32     newlines are allowed between the trailing ``>`` and the immediately preceding
33     ``--``.
34
35A single exception is defined as well:
36
37
38.. exception:: SGMLParseError
39
126   overridden by a derived class; the base class implementation does nothing.
127
128
129.. method:: SGMLParser.handle_charref(ref)
130
131   This method is called to process a character reference of the form ``&#ref;``.
132   The base implementation uses :meth:`convert_charref` to convert the reference to
133   a string.  If that method returns a string, it is passed to :meth:`handle_data`,
t134-   otherwise :meth:`unknown_charref(ref)` is called to handle the error.
t136+   otherwise ``unknown_charref(ref)`` is called to handle the error.
135
136   .. versionchanged:: 2.5
137      Use :meth:`convert_charref` instead of hard-coding the conversion.
138
139
140.. method:: SGMLParser.convert_charref(ref)
141
142   Convert a character reference to a string, or ``None``.  *ref* is the reference
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op