summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-06-23 13:27:51 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-06-23 13:27:51 (GMT)
commit3861d8b27127a261391ee49ff8634a4ef3ba1dd3 (patch)
treec76b34f4269c742f50be485890703200262def43 /Doc
parenta4db02c7a38c5669b5678f1e972d8b9c6d3a2238 (diff)
downloadcpython-3861d8b27127a261391ee49ff8634a4ef3ba1dd3.zip
cpython-3861d8b27127a261391ee49ff8634a4ef3ba1dd3.tar.gz
cpython-3861d8b27127a261391ee49ff8634a4ef3ba1dd3.tar.bz2
#15114: the strict mode of HTMLParser and the HTMLParseError exception are deprecated now that the parser is able to parse invalid markup.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/html.parser.rst21
1 files changed, 15 insertions, 6 deletions
diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst
index f3c36ec..4715185 100644
--- a/Doc/library/html.parser.rst
+++ b/Doc/library/html.parser.rst
@@ -16,13 +16,14 @@
This module defines a class :class:`HTMLParser` which serves as the basis for
parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML.
-.. class:: HTMLParser(strict=True)
+.. class:: HTMLParser(strict=False)
- Create a parser instance. If *strict* is ``True`` (the default), invalid
- HTML results in :exc:`~html.parser.HTMLParseError` exceptions [#]_. If
- *strict* is ``False``, the parser uses heuristics to make a best guess at
- the intention of any invalid HTML it encounters, similar to the way most
- browsers do. Using ``strict=False`` is advised.
+ Create a parser instance. If *strict* is ``False`` (the default), the parser
+ will accept and parse invalid markup. If *strict* is ``True`` the parser
+ will raise an :exc:`~html.parser.HTMLParseError` exception instead [#]_ when
+ it's not able to parse the markup.
+ The use of ``strict=True`` is discouraged and the *strict* argument is
+ deprecated.
An :class:`.HTMLParser` instance is fed HTML data and calls handler methods
when start tags, end tags, text, comments, and other markup elements are
@@ -34,6 +35,10 @@ parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML.
.. versionchanged:: 3.2 *strict* keyword added
+ .. deprecated-removed:: 3.3 3.5
+ The *strict* argument and the strict mode have been deprecated.
+ The parser is now able to accept and parse invalid markup too.
+
An exception is defined as well:
@@ -46,6 +51,10 @@ An exception is defined as well:
detected, and :attr:`offset` is the number of characters into the line at
which the construct starts.
+ .. deprecated-removed:: 3.3 3.5
+ This exception has been deprecated because it's never raised by the parser
+ (when the default non-strict mode is used).
+
Example HTML Parser Application
-------------------------------