[XML-SIG] how to obtain Byte offset from the Locator...

Greg Wolff pwolff@mgfairfax.rr.com
Sat, 06 May 2000 21:49:28 -0400


I've a question for this list about obtaining location information
during an event call back to the document handler.  I'm writing my first
Python xml script and having a good time with it.  (This C++ dude thinks
Python is great...)  But, I can't see how to obtain the byte offset from
the locator.

In expat's C/C++ interface there is a routine

    long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);

that allows me to acquire the current byte offset during an event call
back.  In the Python interface in SAX there is no equivalent routine. 
Of course, the java documentation of SAX does not document any way to
get the byte offset either.

My question is:

    Is there any way to acquire the byte offset of the current Line and
Column that the Locator is pointing to during an event call back?

I need the information for search indices that I'm building and would
rather build the code in Python than C++.

Thanks for the help!

Greg Wolff
pwolff@cox.rr.com