mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #14207: the ParseError exception raised by _elementtree was made
consistent to the one raised by the Python module (the 'code' attribute was added). In addition, the exception is now documented. Added a test to check that ParseError has the required attributes, and threw away the equivalent doctest which is no longer required.
This commit is contained in:
parent
f996e775ea
commit
5b77d81314
3 changed files with 67 additions and 29 deletions
|
@ -198,7 +198,6 @@ Functions
|
|||
Element Objects
|
||||
---------------
|
||||
|
||||
|
||||
.. class:: Element(tag, attrib={}, **extra)
|
||||
|
||||
Element class. This class defines the Element interface, and provides a
|
||||
|
@ -643,6 +642,24 @@ This is an example of counting the maximum depth of an XML file::
|
|||
>>> parser.close()
|
||||
4
|
||||
|
||||
Exceptions
|
||||
----------
|
||||
|
||||
.. class:: ParseError
|
||||
|
||||
XML parse error, raised by the various parsing methods in this module when
|
||||
parsing fails. The string representation of an instance of this exception
|
||||
will contain a user-friendly error message. In addition, it will have
|
||||
the following attributes available:
|
||||
|
||||
.. attribute:: code
|
||||
|
||||
A numeric error code from the expat parser. See the documentation of
|
||||
:mod:`xml.parsers.expat` for the list of error codes and their meanings.
|
||||
|
||||
.. attribute:: position
|
||||
|
||||
A tuple of *line*, *column* numbers, specifying where the error occurred.
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue