SAX2 is not necessarily about large files. For instance it can be easily utilized to create print layouts. You have your handles, which draw circles, lines, text, etc and the SAX parser calls them sequentially with parameters from the controlling XML file. This way you 'draw' to a QPrinter.
In this scenario you are not interested a particular data structure in memory. Choosing DOM would be definitely the wrong tool.
I don't really see SAX2 and DOM as interchangeably. When your problem actually demands a DOM approach, but because of memory problems you are forced to use SAX2, it always is an ugly crutch.
I'd say: Use SAX2 if you have to control something, use DOM if you have to store something. Of course this is only a rough guideline.






Reply With Quote
Bookmarks