DOM was designed as a language-independent object model to hold any XML data, and as such is a large and complex system. It suits well the two-phase approach of first loading an XML document in, then performing various operations on it. SAX, on the other hand, was designed as a fairly light-weight system using a single-phase approach. With SAX, user-specified operations are performed as the document is loaded. Some applications use SAX to generate a smaller object model, with uninteresting information filtered out, which is then processed similarly to DOM. Note that although DOM and SAX are the well-known "standard" XML APIs, there are plenty of others available, and sometimes a particular application may be better off using a non-standard API. With XML the important bit is always the data; code can be rewritten.
1)SAX is faster than DOM. 2)SAX is good for large documents because it takes comparitively less memory than Dom. 3)SAX takes less time to read a document where as Dom takes more time. 4)With SAX we can access data but we can't modify data.With Dom we can modify data. 5)We can stop the SAX parsing when ever and where ever you want. 6)SAX is sequential parsing but with DOM we can move to back also. 7)To parse machine generated code SAX is better.To parse human readable documents DOM is useful.
[This message has been edited by Murali Mohan (edited June 15, 2001).]
He's my best friend. Not yours. Mine. You can have this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!