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.

Author robinbryce2
Recipients
Date 2006-08-11.13:27:12
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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
History
Date User Action Args
2007-08-23 15:54:03adminlinkissue1538691 messages
2007-08-23 15:54:03admincreate