Amazon Interview Question
Software Engineer / Developers1. a. DOM stands for Document Object Model.
b. SAX stands for Simple API for XML.
2. a. DOM reads entire XML file at once.
b. SAX reads XML file line by line.
3. a. DOM is memory consuming.
b. SAX is not.
4 a. DOM follows hierarchical model
b. SAX follows event based model while reading XML.
5 a. Using DOM we can add,remove update the XML elements
b. SAX is read only.
and etc
I know these only
Thanks
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.
- vind July 12, 2011SAX, 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.
ref: coderanch . com/t/122873/XML/SAX-vs-DOM-when-them