|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: The subsetting has begun
> Karl Waclawek scripsit: > > > I agree. It would be nice, however, if SAX for instance allowed > > an application to stop parsing (based on an event) without > > having to throw an exception. > > What's wrong with exceptions? This kind of thing, abandoning an action, > is what they were made for. Maybe that is different for Java, but in general this is simply wrong. Program flow should not be controlled with exceptions. Apart from that they are expensive in most languages. And you have to trap them in your app, since you might not actually want to terminate the routine where the parse call returns to. In addition, low level code should return a status and leave the decision whether an exception should be thrown to the higher level code that has sufficient context to make it. > If one of your SAX handlers decides that > there is no point in reading further, create an AllDoneException packaged > inside a SAXException, and away we go. Well, we (a group of programmers) ported SAX2 to Delphi. On Delphi the idea of using exceptions for regular program flow control is just not right. Same in C++. And like C++, Delphi is sometimes used for speed, meaning that one takes care about memory allocations. Exceptions are too expensive from that point of view, which matters if the program is meant to continue, and matters less if the current context has to be terminated. Karl
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








