minidom help -- line number
ian.g.kelly at gmail.com
Sat Aug 14 20:11:56 CEST 2010
On Sat, Aug 14, 2010 at 11:56 AM, Thomas Jollans <thomas at jollybox.de> wrote:
> The DOM is disjunct from the original file, stream, string, etc. That's in the
> nature of the DOM, and it's probably true for most, if not all, DOM
> implementations, in other programming languages as well as Python.
> If you want to stay close to the file, you're better of with SAX. (or a
> similar approach, like eXpat)
The minidom parse function can also accept any SAX2 parser, so it
should be possible to create a customized parser that stashes the line
numbers somewhere and use that together with minidom. I've never
attempted this myself, so I won't be able to help with details.
More information about the Python-list