This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Allow non-default XML parsers to take advantage of a _parse_whole definition in xml.etree.ElementTree.ElementTree.parse()
Type: enhancement Stage:
Components: Library (Lib), XML Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eli.bendersky, gphemsley, scoder
Priority: normal Keywords:

Created on 2017-12-24 19:08 by gphemsley, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg309011 - (view) Author: Gordon P. Hemsley (gphemsley) * Date: 2017-12-24 19:08
Currently, ElementTree.parse() in xml.etree.ElementTree only invokes _parse_whole() on the parser if no parser is specified and it falls back to the built-in XMLParser.

This has two drawbacks:
* If the built-in XMLParser is specified explicitly, it does not get the advantage of using its _parse_whole() method.
* If another XML parser is specified, it does not have the option to define a _parse_whole() method.

In both cases, the parser parses in chunks (of 16 KiB), which is potentially slower.

I propose allowing any parser to take advantage of _parse_whole() if it has defined such a method. (This would also have the benefit of eliminating some minor code duplication--two return branches could become one.)
msg309012 - (view) Author: Gordon P. Hemsley (gphemsley) * Date: 2017-12-24 19:09
Sorry, the chunks are 64 KiB.
History
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76606
2017-12-24 19:09:24gphemsleysetmessages: + msg309012
2017-12-24 19:08:23gphemsleycreate