[XML-SIG] Getting the line number from an XML file

Joakim Hove Joakim.Hove@phys.ntnu.no
22 Nov 2000 10:50:09 +0100


I'm in the process of teaching myself some XML by writing a simple
program for handling bibliographic references. I have started with the
"qtfmt.py" example in the demo/quotes/ directory of the PyXML
distribution, and hence "drv_pyexpat.py" driver [Currently I have no
clue in how to chose in the myriad of different drivers - but that
will probably come ...].

Now, I want to get the line-number where a certain entity is defined,
so during parsing the program should write to stdout:

Found <xx> on line nnn ...
Fount <yy> on line nnn ...

The driver I'm using has the locator routines getLineNumber and
getColumnNumber, but according to comments in the code they are only
usable after an error. I would like to call these methods irrespective
of whether an error has occured. Is this possible??


=3D=3D=3D Joakim Hove      www.phys.ntnu.no/~hove/   =3D=3D=3D=3D=3D=3D=3D=
# Institutt for fysikk  (735) 93637 / E3-166  |  Sk=F8yensgate 10D    #
# N - 7491 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim #
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 73 93=
 31 68 =3D=3D=3D=3D=3D=3D=3D=3D