Limited XML tidy

uche.ogbuji at gmail.com uche.ogbuji at gmail.com
Thu Aug 25 17:10:08 EDT 2005


> The problem is that when the sax handler raises an exception,
I can't see how to find out why. What I want to do is for
DodgyErrorHandler to do something different depending on
where we are in the course of parsing. Is there anyway
to get that information back from xml.sax (or indeed from
any other sax handler?)

You can get raw location information, yes.  See:

http://www.xml.com/pub/a/2004/11/24/py-xml.html

But I don't think this is enough for you.  You also need recovery,
which you're implementing in crude form.

I tend to agree with Magnus that using an SGML parser might be your
best bet.  You might even be able to turn that SGML into XML using a
tool such as James Clark's SX:

http://www.jclark.com/sp/sx.htm

-- 
Uche
http://copia.ogbuji.net




More information about the Python-list mailing list