diff options
author | Dave Cole <djc@object-craft.com.au> | 2004-08-26 00:37:31 (GMT) |
---|---|---|
committer | Dave Cole <djc@object-craft.com.au> | 2004-08-26 00:37:31 (GMT) |
commit | 3203efb55fde14c3f567f6864dab1454155d1dcb (patch) | |
tree | b550584948252f2d7677e877776bb3cdeae8faaf /Modules | |
parent | 0d58e2be0b81c12b0056d458a0480dc525af1abb (diff) | |
download | cpython-3203efb55fde14c3f567f6864dab1454155d1dcb.zip cpython-3203efb55fde14c3f567f6864dab1454155d1dcb.tar.gz cpython-3203efb55fde14c3f567f6864dab1454155d1dcb.tar.bz2 |
Patch #1014930. Expose current parse location to XMLParser.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/pyexpat.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 3bee0ac..d5929b6 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1455,6 +1455,17 @@ xmlparse_getattr(xmlparseobject *self, char *name) return PyInt_FromLong((long) XML_GetErrorByteIndex(self->itself)); } + if (name[0] == 'C') { + if (strcmp(name, "CurrentLineNumber") == 0) + return PyInt_FromLong((long) + XML_GetCurrentLineNumber(self->itself)); + if (strcmp(name, "CurrentColumnNumber") == 0) + return PyInt_FromLong((long) + XML_GetCurrentColumnNumber(self->itself)); + if (strcmp(name, "CurrentByteIndex") == 0) + return PyInt_FromLong((long) + XML_GetCurrentByteIndex(self->itself)); + } if (name[0] == 'b') { if (strcmp(name, "buffer_size") == 0) return PyInt_FromLong((long) self->buffer_size); @@ -1503,6 +1514,9 @@ xmlparse_getattr(xmlparseobject *self, char *name) APPEND(rc, "ErrorLineNumber"); APPEND(rc, "ErrorColumnNumber"); APPEND(rc, "ErrorByteIndex"); + APPEND(rc, "CurrentLineNumber"); + APPEND(rc, "CurrentColumnNumber"); + APPEND(rc, "CurrentByteIndex"); APPEND(rc, "buffer_size"); APPEND(rc, "buffer_text"); APPEND(rc, "buffer_used"); |