Draconian Error Handling

This innocent-looking definition embodies one of the most important and unprecedented aspects of XML: "Draconian" error-handling. Dracon (c.659-c.601 B.C.E.) introduced the first written legislation to Athens. His code was consistent in that it decreed the death penalty for crimes both low and high. Similarly, a conforming XML processor must "not continue normal processing" once it detects a fatal error. Phrases used to amplify this wording have included "halt and catch fire", "barf", "flush the document down the toilet", and "penalize innocent end-users".

The motivation for this policy is simple. We want XML to empower programmers to write code that can be transmitted across the Web and execute on a large number of desktops. However, if this code must include error-handling for all sorts of sloppy end-user practices, it will of necessity balloon in size to the point where it, like Netscape Navigator, or Microsoft Internet Explorer, is tens of megabytes in size, thus defeating the purpose.

The circumstances that produce the Draconian behavior - "fatal errors" - are all failures to attain the condition of well-formedness. Well-formedness doesn't cost much; the tags have to be balanced, the entities have to be declared, and attributes have to be quoted; that's about it. The benefits of well-formedness - the empowering of programmers discussed above - are high. Thus Draconian error-handling is arguably a good trade-off.

However, it is also arguably not. It is directly contradictory to the spirit of HTML, where tool vendors compete on their ability to handle egregiously broken pages. It is also counter to SGML practice, where tools often make a best-effort attempt to continue in the face of errors. These facts led to a debate on this particular subject that was as intense and prolonged as any in the history of the XML project. The final majority in favor of the Draconian policy was large but by no means 100%.

Increasing the level of interest in this debate was the fact that the Draconian policy was requested, separately and independently, by Netscape and Microsoft, who were bitterly aware of the consequences of trying to work around user error in the extreme case. I don't think anybody really would retroactively have changed the policy of forgiveness as regards HTML; it is one of the reasons for the success of the Web. But in the case of XML, we have it as an explicit goal that this should be fodder for programs other than screen-painters; given this, the Draconian policy eventually managed to build what amounted to consensus support.

Back-link to spec

Copyright © 1998, Tim Bray. All rights reserved.