[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [xml-dev] DOM or SAX: Sense and Sensibility
From: Bullard, Claude L (Len) [mailto:email@example.com]
Sent: Wednesday, November 7, 2001 12:23 PM
> A topic for the usual Friday introspection two
> days early:
> How often do you as experienced XML developers
> find people in your shop using DOM for work
> more appropriate to SAX? Have you asked
> them why and what do they say? What are the
> costs of picking the wrong API?
Without any hard data, here are some reasons I suspect come into play when
people choose the DOM over SAX, when SAX might be more appropriate:
1) A lot of programmers are not really used to event-based programming, as
used by SAX. They're more comfortable working with an in-memory object
model than in keeping track of context as events are passed in, etc.
2) Unfortunately, programmers [including myself] often test their code with
much smaller data sets than they can expect in real life. One of the
reasons one might choose SAX over the DOM is that one is working with very
large XML documents, but if one is not testing one's code with large
documents, one might not realize one needs SAX until it's too late...
3) For COM programmers, who use Microsoft technologies extensively: MSXML
had [some] DOM support long before it had SAX support. I think a lot of
programmers, who aren't XML gurus, just got used to the fact that "this is
the way you work with XML". I've even heard people referring to an XML
document as "a DOM", which shows how deep the confusion can go.