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

Greg Wolff pwolff@mgfairfax.rr.com
Tue, 09 May 2000 14:52:31 -0400


I have a copy of expat for my C++ code but I have found that I don't
have a copy of the driver for expat for the Python code.  I have the
xmlproc code and it works just fine, but it doesn't have byte offset as
far as I can tell.  (My first cursory look at the code suggests that it
would be better to ask you'all for help rather than try to hack it...)

Which file on the xml-sig download page has the Python Expat code in
it?  I have tried to download a pyexpat file but the link was broken
last night when I tried it.  If I can get the pyexpat code I'll hack it
as Lars M. suggests below (Thanks!).

Also, is there any chance of trying to work with the SAX 2.0 Python
code?

Thanks for the help.
/pgw
Greg Wolff

Lars Marius Garshol wrote:
> 
> * Greg Wolff
> |
> | But, I can't see how to obtain the byte offset from
> | the locator.
> 
> There is no way to do that with the Locator.
> 
> I plan to add SAX 2.0 properties for the byte offset to the expat and
> xmlproc drivers, since both support this functionality, but at the
> moment there is no standard way to do this.
> 
> .....
> 
> | I need the information for search indices that I'm building and would
> | rather build the code in Python than C++.
> 
> If you _know_ that you are using the expat driver you can look at the
> drv_pyexpat.py code and see how to find a reference to the expat
> Parser object and try to get the information from there. Not really
> the recommended way to do it, but it should work.
> 
> --Lars M.
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig