Hello,
I'm using lxml to parse Apple XML Property List files, by passing the
XMLParser a custom PlistTarget object that builds python data structures
(dict, list, int, float, etc.) from plist elements using the "target parser
interface".
This works well, however sometimes I need to raise an exception from inside
my PlistTarget class to signal some unexpected elements or a missing value
for a given plist dict key, etc.
I would like to give the user the current line number along with the
…
[View More]exception error message.
But I can't get the Element.sourceline because I'm not building an XML
element tree, my target class doesn't know the parser it is been used by,
and it doesn't receive element objects, just start, end, and data and close
events.
Do you know a way (from pure Python, I would prefer not to reach down into
Cython) to get the parser's current line number from within a target object?
Anyway, thank you for this great library!
Cheers
Cosimo
--
Cosimo Lupo
[View Less]