> > The point is not to build a tree of potentially unbounded size
> > (think
> > XMPP). The point is to yield events in a non-blocking way
> > (iterparse()
> > is blocking, which makes it useless for non-blocking applications).
>
> Ok, but that's the only difference. Instead of getting the events
> from the parser, you could equally well get them from the
> TreeBuilder, also in a non-blocking way.
But your TreeBuilder is also growing a tree internally, and therefore
eating more and more memory, right?
I don't see the point of stuffing different kinds of functionality
inside a single class. It makes the intended use less obvious, and
errors more likely. Right now, IncrementalParser has a simple API,
and there's a single way to use it. |