classification
Title: Sax parser provides no user access to lexical handlers
Type: enhancement Stage: resolved
Components: XML Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Jonathan.Gossage, ZackerySpytz, scoder, taleinat
Priority: normal Keywords: patch

Created on 2018-10-18 16:22 by Jonathan.Gossage, last changed 2020-08-09 10:52 by scoder. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10328 closed Jonathan.Gossage, 2018-11-05 02:36
PR 20958 merged ZackerySpytz, 2020-06-18 05:52
Messages (2)
msg327982 - (view) Author: Jonathan Gossage (Jonathan.Gossage) * Date: 2018-10-18 16:22
While working on issues bpo-6686 and bpo-9371 I realized that the solution to both involved the use of Sax lexical handlers. Unfortunately, the Python SAX parser does not expose these handlers to the end user, however, support is available in expatreader.py and pyexpat.c.

What is missing is the LexicalHandler class which works the same way as the ContentHandler does for the more common handlers and provides a subclassable interface for these handlers. This class is present in the Java implementation of SAX2 and was also present in Pyxml.

I have already verified privately that this class works exactly as expected and I am working on a PR which will provide the class along with supporting unit tests that verify that the lexical handlers work.
msg375066 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2020-08-09 10:51
New changeset e28b8c93878072dc02b116108ef5443084290d47 by Zackery Spytz in branch 'master':
bpo-35018: Sax parser should provide user access to lexical handlers (GH-20958)
https://github.com/python/cpython/commit/e28b8c93878072dc02b116108ef5443084290d47
History
Date User Action Args
2020-08-09 10:52:55scodersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-08-09 10:51:20scodersetmessages: + msg375066
2020-06-18 08:06:29ZackerySpytzsetversions: + Python 3.10, - Python 3.8
2020-06-18 05:52:05ZackerySpytzsetnosy: + ZackerySpytz
pull_requests: + pull_request20136
2019-05-30 20:00:04cheryl.sabellasetnosy: + scoder
2018-11-05 02:36:06Jonathan.Gossagesetkeywords: + patch
stage: patch review
pull_requests: + pull_request9631
2018-10-18 19:05:51Jonathan.Gossagesetcomponents: + XML
2018-10-18 16:22:21Jonathan.Gossagecreate