Issue 1014930: Expose current parse location to XMLParser (original) (raw)

Created on 2004-08-24 02:44 by davecole, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pyexpat.diff davecole,2004-08-24 02:44 Adds current parse location to expat XMLParser
pyexpat-v2.diff davecole,2004-08-26 00:35 Updated patch including reviewer suggestions
Messages (5)
msg46772 - (view) Author: Dave Cole (davecole) (Python triager) Date: 2004-08-24 02:44
This patch adds CurrentByteIndex, CurrentColumnNumber, CurrentLineNumber members to the xml.parsers.expat.XMLParser object which respectively wrap the XML_GetCurrentByteIndex, XML_GetCurrentLineNumber, and XML_GetCurrentColumnNumber expat functions.
msg46773 - (view) Author: Dave Cole (davecole) (Python triager) Date: 2004-08-24 02:47
Logged In: YES user_id=28658 Oops - obviously CurrentColumnNumber wraps XML_GetCurrentColumnNumber, and CurrentLineNumber wraps XML_GetCurrentLineNumber.
msg46774 - (view) Author: Dima Dorfman (ddorfman) Date: 2004-08-24 06:45
Logged In: YES user_id=908995 The patch looks good to me after a quick glance and test run. Maybe add something to the test suite to exercise these attributes? It should be as easy as adding print statements to a handler or two (the test relies heavily on comparing the output to a known one). Most of the other attributes aren't tested-for by the test suite, though. \versionadded in the docs might be nice, too--just once, after the paragraph introducing them.
msg46775 - (view) Author: Dave Cole (davecole) (Python triager) Date: 2004-08-26 00:35
Logged In: YES user_id=28658 Have added a unit test to check that the Current* members do return something useful for parser events. Decided against testing character data events as there can be more than one per section of character data - this might be fragile in the face of newer expat versions. Oh, also added a \versionadded. Will apply this patch.
msg46776 - (view) Author: Dave Cole (davecole) (Python triager) Date: 2004-08-26 00:41
Logged In: YES user_id=28658 Patch applied: Doc/lib/libpyexpat.tex; new revision: 1.24 Lib/test/test_pyexpat.py; new revision: 1.16 Misc/NEWS; new revision: 1.1114 Modules/pyexpat.c; new revision: 2.88
History
Date User Action Args
2022-04-11 14:56:06 admin set github: 40813
2004-08-24 02:44:34 davecole create