Any way to get current file position in xml.parsers.expat?

Van Gale cgale1 at _remove_home.com
Fri Jul 13 09:30:52 CEST 2001


"C. Laurence Gonsalves" <clgonsal at keeshah.penguinpowered.com> wrote in
message news:slrn9kt86i.750.clgonsal at keeshah.penguinpowered.com...
> Unfortunately, I can't find any way to get the current position in the
> file when using ParseFile. I know that if expat throws an ExpatError,
> that will contain the line and column number, but that doesn't help me
> in this situation, as the file is 'well formed' XML as far as expat is
> concerned.
>
> So is there any way to ask the expat parser where it is in the file?
> Even a byte offset from the beginning of the file would be better than
> nothing.

I'm pretty sure ErrorColumnNumber, ErrorLineNumber, and ErrorByteIndex are
updated even when there is no error.

Van






More information about the Python-list mailing list