[Patches] [ python-Patches-1538691 ] Patch cElementTree to export CurrentLineNumber

SourceForge.net noreply at sourceforge.net
Fri Aug 11 15:27:13 CEST 2006


Patches item #1538691, was opened at 2006-08-11 14:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1538691&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robin Bryce (robinbryce2)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch cElementTree to export CurrentLineNumber

Initial Comment:
This patch provides to the 'current' position expat api
via cElementTree.XMLTreeBuilder.

pyexpat already exposes this via the attributes
CurrentLineNumber, CurrentColumnNumber and
CurrentByteIndex. In order for cElementTree to do the
same, the following expat functions are added to those
exported via the pyexpat capi:
 * XML_CurrentLineNumber
 * XML_CurrentColumnNumber
 * XML_CurrentByteIndex

Then, in _elementtree.c, the xmlparser_getattr is made
to mirror the provisions made in pyexpat. A trivial
test is added to test_etree_c.py to cover the three new
attributes.

This patch was motivated by a discussion[1] on the
turbogears list that referenced two xml templating
libraries Kid & Markup. One of the benefits of the
latter is the ability to report line numbers for
template source errors.

If this patch is applied it should be possible for Kid,
and anything else that uses cElementTree for
xmlparsing, to do the same.

[1]
http://groups.google.com/group/turbogears/browse_frm/thread/1ed59ed984fc8bbe/1f06eb00e83f93d9#1f06eb00e83f93d9

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

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


More information about the Patches mailing list