xml.sax: Raising Exception with line number of xml source

  • Thread starter Thomas Guetttler
  • Start date
T

Thomas Guetttler

Hi!

How can I raise an exception while parsing with sax,
which contains the current line in the xml-file?

I want to create an message like this:
test.xml: Line: 100, Col: 20: <foo> not allowed in <bar>

I have the filename in my content handler. I just need
the line und column number.

thomas
 
T

Thomas Guetttler

Am Mon, 08 Sep 2003 17:08:56 +0200 schrieb Thomas Guetttler:
Hi!

How can I raise an exception while parsing with sax,
which contains the current line in the xml-file?

I want to create an message like this:
test.xml: Line: 100, Col: 20: <foo> not allowed in <bar>

I have the filename in my content handler. I just need
the line und column number.


Found it myself:

in e.g. startElement() of MyContentHandler:
self._locator.getLineNumber()

thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top