Pierpaolo Fumagalli wrote: > Since with SAX 2.0 we'll be able to fully build a DOM, what about > "dropping" the current DOMParser and SAXParser, keeping just one of them > (the SAX one) and relying on a SAX-to-DOM to get the documents? > I don't know how DOM level 2 and 3 would fit in this picture, but, as > far as I'm concerned (DOM1) this is more than possible...
Unfortunately, there are currently features in DOM that are not possible to build via SAX2 callbacks. And I would guess that this separation will only increase over time as the various DOM specifications are developed. For example, how would you use SAX2 callbacks to put general entity references in attribute values of DOM elements? (We don't actually have the capability to do this now -- but we should!) And when DOM Level 3 handles grammar access, what SAX2 calls are going to allow this to be generated? We would need a SAX3, SAX4, and so on just to keep up with DOM compliance. For more examples from DOM Level 1, think about default attribute values. Where does SAX2 allow the handler to know what these are so that the DOM behaves correctly when editing an element's attributes? org.xml.sax.Attributes doesn't even tell you if the attribute was specified or defaulted from the grammar. I would say that DOM and SAX are different enough to argue for keeping them separate. Just because you can build a subset of the DOM from SAX2 callbacks doesn't mean that we should restrict all DOM trees to be constructed this way using our parser. -- Andy Clark * IBM, JTC - Silicon Valley * [EMAIL PROTECTED]
