[Patches] [ python-Patches-1014930 ] Expose current parse location to XMLParser

SourceForge.net noreply at sourceforge.net
Thu Aug 26 02:35:30 CEST 2004


Patches item #1014930, was opened at 2004-08-24 02:44
Message generated for change (Comment added) made by davecole
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1014930&group_id=5470

Category: XML
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Dave Cole (davecole)
Assigned to: Dave Cole (davecole)
Summary: Expose current parse location to XMLParser

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Dave Cole (davecole)
Date: 2004-08-26 00:35

Message:
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.

----------------------------------------------------------------------

Comment By: Dima Dorfman (ddorfman)
Date: 2004-08-24 06:45

Message:
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.

----------------------------------------------------------------------

Comment By: Dave Cole (davecole)
Date: 2004-08-24 02:47

Message:
Logged In: YES 
user_id=28658

Oops - obviously CurrentColumnNumber wraps
XML_GetCurrentColumnNumber, and CurrentLineNumber wraps
XML_GetCurrentLineNumber.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1014930&group_id=5470


More information about the Patches mailing list