Expat current line/column number
Nicolas Fleury
nid_oizo at yahoo.com_remove_the_
Wed Oct 15 15:09:45 EDT 2003
More information about the Python-list mailing list
Wed Oct 15 15:09:45 EDT 2003
- Previous message (by thread): Expat current line/column number
- Next message (by thread): Expat current line/column number
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alan Kennedy wrote: > [Nicolas Fleury] > >>This is exactly what I mean. Unfortunately, I've use the parser in >>xml.parsers.expat and not xml.sax, and it seems that parser only >>provides line and column numbers for its own exceptions. > > > Ah. I think this solves the problem. > (...) > > Not quite as clean though, because of the requirement to declare > 'parser' as a global. To get rid of the 'global' declaration, you > could always wrap up your handlers in a class, and set the parser as > an attribute of each instance. Yes, it seems expat reset line and column numbers when leaving parsing function. It is a little bit limiting, since like you said, the handler must know the parser. In my case it's not that bad; since I only use startElement and endElement, I will only need to add try blocks in these two functions. Thx for your help. Regards, Nicolas Fleury
- Previous message (by thread): Expat current line/column number
- Next message (by thread): Expat current line/column number
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list