Message194741
> TreeBuilder doesn't do parsing, it takes already parsed data: it has a
> start() method to open a tag, and a data() method to add raw text
> inside that tag.
That is correct. However, the XMLParser has a feed() method that sends new data into the parser, and a close() method that tells the parser that it's done. So there already is an incremental parsing interface, and your change is duplicating that interface under a different name. Specifically, IncrementalParser has exactly the same interface as XMLParser when it comes to entering data, but uses different method names for it. This is a Bad Design because it introduces an unnecessary inconsistency in the API.
However, what you are trying to change is not the way data is *entered* into the parser. What you are after is to change the way the *parsed* data is *presented* to the user. That is not the responsibility of the parser, it's the responsibility of the TreeBuilder.
In your code, the TreeBuilder builds a tree, and the new interface *additionally* collects parse events in a list. So, the right way to do it would be to change the parser *target* to do both, i.e. to build a tree and collect events at the same time. |
|
Date |
User |
Action |
Args |
2013-08-09 15:12:46 | scoder | set | recipients:
+ scoder, jcea, pitrou, eli.bendersky, flox, python-dev |
2013-08-09 15:12:46 | scoder | set | messageid: <1376061166.65.0.0323609506511.issue17741@psf.upfronthosting.co.za> |
2013-08-09 15:12:46 | scoder | link | issue17741 messages |
2013-08-09 15:12:46 | scoder | create | |
|